UnitAccountReceivable.php 4.4 KB

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