UnitAccountPayable.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 int|null $franchisee_account_receive_id
  11. * @property string $origin
  12. * @property string $history
  13. * @property numeric $value
  14. * @property numeric $paid_value
  15. * @property numeric $discount
  16. * @property numeric $fine
  17. * @property \Illuminate\Support\Carbon $due_date
  18. * @property \Illuminate\Support\Carbon|null $payment_date
  19. * @property string $status
  20. * @property string|null $obs
  21. * @property-read \App\Models\Unit $unit
  22. * @property-read \App\Models\FranchiseeAccountReceive|null $franchiseeAccountReceive
  23. */
  24. class UnitAccountPayable extends Model
  25. {
  26. use HasFactory, SoftDeletes;
  27. public const ORIGIN_TBR = 'tbr';
  28. public const ORIGIN_MANUAL = 'manual';
  29. protected $table = 'unit_account_payables';
  30. protected $guarded = ['id'];
  31. protected $casts = [
  32. 'value' => 'decimal:2',
  33. 'paid_value' => 'decimal:2',
  34. 'discount' => 'decimal:2',
  35. 'fine' => 'decimal:2',
  36. 'due_date' => 'date',
  37. 'payment_date' => 'date',
  38. 'created_at' => 'datetime',
  39. 'updated_at' => 'datetime',
  40. 'deleted_at' => 'datetime',
  41. ];
  42. public function unit(): BelongsTo
  43. {
  44. return $this->belongsTo(Unit::class, 'unit_id');
  45. }
  46. public function franchiseeAccountReceive(): BelongsTo
  47. {
  48. return $this->belongsTo(FranchiseeAccountReceive::class, 'franchisee_account_receive_id');
  49. }
  50. }