*/ protected $fillable = [ 'tenant_id', 'amount', 'status', 'due_date', 'student_user_id', 'payer_user_id', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'amount' => 'decimal:2', 'due_date' => 'date', ]; /** * Get the tenant that owns the invoice. */ public function tenant(): BelongsTo { return $this->belongsTo(Tenant::class); } /** * Get the student user that owns the invoice. */ public function student(): BelongsTo { return $this->belongsTo(User::class, 'student_user_id'); } /** * Get the payer user that owns the invoice. */ public function payer(): BelongsTo { return $this->belongsTo(User::class, 'payer_user_id'); } }