CompanyAccountPayable.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. * Contas a Pagar da matriz (franqueadora) — lançamentos manuais.
  9. *
  10. * @property int $id
  11. * @property int|null $financial_plan_account_id
  12. * @property string $origin
  13. * @property string $history
  14. * @property numeric $value
  15. * @property numeric $paid_value
  16. * @property numeric $discount
  17. * @property numeric $fine
  18. * @property \Illuminate\Support\Carbon $due_date
  19. * @property \Illuminate\Support\Carbon|null $payment_date
  20. * @property string $status
  21. * @property string|null $obs
  22. * @property \Illuminate\Support\Carbon|null $created_at
  23. * @property \Illuminate\Support\Carbon|null $updated_at
  24. * @property \Illuminate\Support\Carbon|null $deleted_at
  25. * @property-read \App\Models\FinancialPlanAccount|null $planAccount
  26. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable newModelQuery()
  27. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable newQuery()
  28. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable onlyTrashed()
  29. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable query()
  30. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable whereCreatedAt($value)
  31. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable whereDeletedAt($value)
  32. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable whereDiscount($value)
  33. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable whereDueDate($value)
  34. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable whereFinancialPlanAccountId($value)
  35. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable whereFine($value)
  36. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable whereHistory($value)
  37. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable whereId($value)
  38. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable whereObs($value)
  39. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable whereOrigin($value)
  40. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable wherePaidValue($value)
  41. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable wherePaymentDate($value)
  42. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable whereStatus($value)
  43. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable whereUpdatedAt($value)
  44. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable whereValue($value)
  45. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable withTrashed(bool $withTrashed = true)
  46. * @method static \Illuminate\Database\Eloquent\Builder<static>|CompanyAccountPayable withoutTrashed()
  47. * @mixin \Eloquent
  48. */
  49. class CompanyAccountPayable extends Model
  50. {
  51. use HasFactory, SoftDeletes;
  52. public const ORIGIN_MANUAL = 'manual';
  53. protected $table = 'company_account_payables';
  54. protected $guarded = ['id'];
  55. protected $casts = [
  56. 'value' => 'decimal:2',
  57. 'paid_value' => 'decimal:2',
  58. 'discount' => 'decimal:2',
  59. 'fine' => 'decimal:2',
  60. 'due_date' => 'date',
  61. 'payment_date' => 'date',
  62. 'created_at' => 'datetime',
  63. 'updated_at' => 'datetime',
  64. 'deleted_at' => 'datetime',
  65. ];
  66. public function planAccount(): BelongsTo
  67. {
  68. return $this->belongsTo(FinancialPlanAccount::class, 'financial_plan_account_id');
  69. }
  70. }