Anagrafica.php 3.1 KB

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