Anagrafica.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. 'codice_fiscale'
  61. ];
  62. public function birth_town_id_value()
  63. {
  64. return $this->belongsTo(\App\Models\LocationTown::class, 'birth_town_id');
  65. }
  66. public function birth_prov_id_value()
  67. {
  68. return $this->belongsTo(\App\Models\LocationProvince::class, 'birth_prov_id');
  69. }
  70. public function residenza_town_id_value()
  71. {
  72. return $this->belongsTo(\App\Models\LocationTown::class, 'residenza_town_id');
  73. }
  74. public function documento_rilasciato_da_town_id_value()
  75. {
  76. return $this->belongsTo(\App\Models\LocationTown::class, 'documento_rilasciato_da_town_id');
  77. }
  78. public function documento_rilasciato_da_di_foreign_country_value()
  79. {
  80. return $this->belongsTo(\App\Models\LocationCountry::class, 'documento_rilasciato_da_di_foreign_country');
  81. }
  82. public function foreign_birth_country_value()
  83. {
  84. return $this->belongsTo(\App\Models\LocationCountry::class, 'anag_foreign_birth_country');
  85. }
  86. public function foreign_residence_country_value()
  87. {
  88. return $this->belongsTo(\App\Models\LocationCountry::class, 'anag_foreign_residence_country');
  89. }
  90. public function foreign_residence_city_value()
  91. {
  92. return $this->belongsTo(\App\Models\LocationCountry::class, 'anag_foreign_residence_city');
  93. }
  94. public function sede_legale_town_id_value()
  95. {
  96. return $this->belongsTo(\App\Models\LocationTown::class, 'sede_legale_town_id');
  97. }
  98. public function sede_legale_prov_id_value()
  99. {
  100. return $this->belongsTo(\App\Models\LocationProvince::class, 'sede_legale_prov_id');
  101. }
  102. public function residenza_prov_id_value()
  103. {
  104. return $this->belongsTo(\App\Models\LocationProvince::class, 'residenza_prov_id');
  105. }
  106. public function get($key)
  107. {
  108. return $this->getAttribute($key);
  109. }
  110. }