Unit.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  6. use Illuminate\Database\Eloquent\SoftDeletes;
  7. /**
  8. * @property int $id
  9. * @property string $fantasy_name
  10. * @property string $social_reason
  11. * @property string $cnpj
  12. * @property string|null $state_registration
  13. * @property string $name_responsible
  14. * @property string $street
  15. * @property string|null $address_number
  16. * @property string $postal_code
  17. * @property string $neighborhood
  18. * @property string|null $complement
  19. * @property int $city_id
  20. * @property int $state_id
  21. * @property string $email
  22. * @property string|null $secondary_email
  23. * @property string $phone_number
  24. * @property string|null $cell_number
  25. * @property string|null $avatar_url
  26. * @property \Carbon\Carbon $created_at
  27. * @property \Carbon\Carbon $updated_at
  28. * @property \Carbon\Carbon|null $deleted_at
  29. * @property-read \App\Models\City $city
  30. * @property-read \App\Models\State $state
  31. */
  32. class Unit extends Model
  33. {
  34. use HasFactory, SoftDeletes;
  35. protected $table = 'units';
  36. protected $guarded = ['id'];
  37. protected $casts = [
  38. 'created_at' => 'datetime',
  39. 'updated_at' => 'datetime',
  40. 'deleted_at' => 'datetime',
  41. ];
  42. public function city(): BelongsTo
  43. {
  44. return $this->belongsTo(City::class, 'city_id');
  45. }
  46. public function state(): BelongsTo
  47. {
  48. return $this->belongsTo(State::class, 'state_id');
  49. }
  50. }