Anagrafica.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. class Anagrafica extends Model
  6. {
  7. use HasFactory;
  8. public $timestamps = false;
  9. protected $table = 'fcf_reports_anagraficas';
  10. protected $fillable = [
  11. 'type',
  12. 'firstname',
  13. 'lastname',
  14. 'gender',
  15. 'birth_date',
  16. 'birth_town_id',
  17. 'birth_prov_id',
  18. 'residenza_town_id',
  19. 'residenza_prov_id',
  20. 'residenza_address',
  21. 'residenza_cap',
  22. 'mobile',
  23. 'sedicente',
  24. 'documento_tipo',
  25. 'documento_patente_cat',
  26. 'documento_tipo_altro',
  27. 'documento_numero',
  28. 'documento_rilasciato_da',
  29. 'documento_rilasciato_da_altro',
  30. 'foreign_country',
  31. 'documento_rilasciato_da_di_foreign_localita',
  32. 'documento_rilasciato_da_di_foreign_country',
  33. 'documento_rilasciato_da_prov_id',
  34. 'documento_rilasciato_da_town_id',
  35. 'documento_rilasciato_il',
  36. 'documento_scadenza_il',
  37. 'state',
  38. 'created' ,
  39. 'created_by',
  40. 'updated' ,
  41. 'updated_by',
  42. 'locked' ,
  43. 'locked_by',
  44. 'nazionalita',
  45. 'nazione_straniera',
  46. 'localita_straniera',
  47. 'rag_soc',
  48. 'vat',
  49. 'sede_legale_address',
  50. 'sede_legale_town_id',
  51. 'sede_legale_prov_id',
  52. 'sede_legale_cap',
  53. 'sede_legale_state',
  54. 'phone',
  55. 'anag_foreign_birth_country',
  56. 'anag_foreign_birth_city',
  57. 'anag_foreign_residence_country',
  58. 'anag_foreign_residence_city',
  59. 'residenza_tipo'
  60. ];
  61. public function birth_town_id_value()
  62. {
  63. return $this->belongsTo(\App\Models\LocationTown::class, 'birth_town_id');
  64. }
  65. public function residenza_town_id_value()
  66. {
  67. return $this->belongsTo(\App\Models\LocationTown::class, 'residenza_town_id');
  68. }
  69. public function documento_rilasciato_da_town_id_value()
  70. {
  71. return $this->belongsTo(\App\Models\LocationTown::class, 'documento_rilasciato_da_town_id');
  72. }
  73. public function documento_rilasciato_da_di_foreign_country_value()
  74. {
  75. return $this->belongsTo(\App\Models\LocationCountry::class, 'documento_rilasciato_da_di_foreign_country');
  76. }
  77. public function foreign_birth_country_value()
  78. {
  79. return $this->belongsTo(\App\Models\LocationCountry::class, 'anag_foreign_birth_country');
  80. }
  81. public function foreign_residence_country_value()
  82. {
  83. return $this->belongsTo(\App\Models\LocationCountry::class, 'anag_foreign_residence_country');
  84. }
  85. public function sede_legale_town_id_value()
  86. {
  87. return $this->belongsTo(\App\Models\LocationTown::class, 'sede_legale_town_id');
  88. }
  89. public function sede_legale_prov_id_value()
  90. {
  91. return $this->belongsTo(\App\Models\LocationProvince::class, 'sede_legale_prov_id');
  92. }
  93. public function residenza_prov_id_value()
  94. {
  95. return $this->belongsTo(\App\Models\LocationProvince::class, 'residenza_prov_id');
  96. }
  97. public function get($key)
  98. {
  99. return $this->getAttribute($key);
  100. }
  101. }