Azienda.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. class Azienda extends Model
  6. {
  7. use HasFactory;
  8. protected $fillable = [
  9. 'ragione_sociale',
  10. 'nome_associazione',
  11. 'tipologia',
  12. 'logo',
  13. 'sede_legale_nazione',
  14. 'sede_legale_provincia',
  15. 'sede_legale_comune',
  16. 'sede_legale_indirizzo',
  17. 'sede_legale_cap',
  18. 'sede_operativa_nazione',
  19. 'sede_operativa_provincia',
  20. 'sede_operativa_comune',
  21. 'sede_operativa_indirizzo',
  22. 'sede_operativa_cap',
  23. 'email',
  24. 'pec',
  25. 'telefono',
  26. 'cellulare',
  27. 'partita_iva',
  28. 'codice_fiscale',
  29. 'codice_sdi',
  30. 'chiusura_anno_fiscale',
  31. 'scadenza_abbonamenti',
  32. 'scadenza_pagamenti_uscita',
  33. ];
  34. protected $casts = [
  35. 'chiusura_anno_fiscale' => 'date',
  36. 'scadenza_abbonamenti' => 'date',
  37. 'scadenza_pagamenti_uscita' => 'date',
  38. ];
  39. /**
  40. * Get the logo URL attribute.
  41. *
  42. * @return string|null
  43. */
  44. public function getLogoUrlAttribute()
  45. {
  46. if ($this->logo) {
  47. return asset('storage/' . $this->logo);
  48. }
  49. return null;
  50. }
  51. /**
  52. * Get a formatted list of discipline names.
  53. *
  54. * @return string
  55. */
  56. public function getDisciplineListAttribute()
  57. {
  58. return $this->disciplines->pluck('name')->implode(', ');
  59. }
  60. }