UnitPartner.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 int $unit_id
  10. * @property string $name
  11. * @property string|null $social_name
  12. * @property string|null $role
  13. * @property string $cpf
  14. * @property string|null $rg
  15. * @property \Carbon\Carbon|null $birth_date
  16. * @property float|null $participation
  17. * @property string|null $email
  18. * @property string|null $secondary_email
  19. * @property string|null $phone_number
  20. * @property string|null $cell_number
  21. * @property string|null $postal_code
  22. * @property string|null $street
  23. * @property string|null $address_number
  24. * @property string|null $neighborhood
  25. * @property string|null $complement
  26. * @property int|null $city_id
  27. * @property int|null $state_id
  28. * @property string|null $avatar_url
  29. * @property \Carbon\Carbon $created_at
  30. * @property \Carbon\Carbon $updated_at
  31. * @property \Carbon\Carbon|null $deleted_at
  32. * @property-read \App\Models\Unit $unit
  33. * @property-read \App\Models\City|null $city
  34. * @property-read \App\Models\State|null $state
  35. */
  36. class UnitPartner extends Model
  37. {
  38. use HasFactory, SoftDeletes;
  39. protected $table = 'unit_partners';
  40. protected $guarded = ['id'];
  41. protected $casts = [
  42. 'birth_date' => 'date',
  43. 'participation' => 'decimal:2',
  44. 'created_at' => 'datetime',
  45. 'updated_at' => 'datetime',
  46. 'deleted_at' => 'datetime',
  47. ];
  48. public function unit(): BelongsTo
  49. {
  50. return $this->belongsTo(Unit::class, 'unit_id');
  51. }
  52. public function city(): BelongsTo
  53. {
  54. return $this->belongsTo(City::class, 'city_id');
  55. }
  56. public function state(): BelongsTo
  57. {
  58. return $this->belongsTo(State::class, 'state_id');
  59. }
  60. }