UnitAccountPayable.php 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 \Illuminate\Support\Carbon|null $created_at
  22. * @property \Illuminate\Support\Carbon|null $updated_at
  23. * @property \Illuminate\Support\Carbon|null $deleted_at
  24. * @property-read \App\Models\FranchiseeAccountReceive|null $franchiseeAccountReceive
  25. * @property-read \App\Models\Unit $unit
  26. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable newModelQuery()
  27. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable newQuery()
  28. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable onlyTrashed()
  29. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable query()
  30. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereCreatedAt($value)
  31. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereDeletedAt($value)
  32. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereDiscount($value)
  33. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereDueDate($value)
  34. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereFine($value)
  35. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereFranchiseeAccountReceiveId($value)
  36. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereHistory($value)
  37. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereId($value)
  38. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereObs($value)
  39. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereOrigin($value)
  40. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable wherePaidValue($value)
  41. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable wherePaymentDate($value)
  42. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereStatus($value)
  43. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereUnitId($value)
  44. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereUpdatedAt($value)
  45. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable whereValue($value)
  46. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable withTrashed(bool $withTrashed = true)
  47. * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitAccountPayable withoutTrashed()
  48. * @mixin \Eloquent
  49. */
  50. class UnitAccountPayable extends Model
  51. {
  52. use HasFactory, SoftDeletes;
  53. public const ORIGIN_TBR = 'tbr';
  54. public const ORIGIN_MANUAL = 'manual';
  55. protected $table = 'unit_account_payables';
  56. protected $guarded = ['id'];
  57. protected $casts = [
  58. 'value' => 'decimal:2',
  59. 'paid_value' => 'decimal:2',
  60. 'discount' => 'decimal:2',
  61. 'fine' => 'decimal:2',
  62. 'due_date' => 'date',
  63. 'payment_date' => 'date',
  64. 'created_at' => 'datetime',
  65. 'updated_at' => 'datetime',
  66. 'deleted_at' => 'datetime',
  67. ];
  68. public function unit(): BelongsTo
  69. {
  70. return $this->belongsTo(Unit::class, 'unit_id');
  71. }
  72. public function franchiseeAccountReceive(): BelongsTo
  73. {
  74. return $this->belongsTo(FranchiseeAccountReceive::class, 'franchisee_account_receive_id');
  75. }
  76. }