'datetime', 'amount' => 'decimal:2', ]; public function user(): BelongsToAlias { return $this->belongsTo(User::class); } public function scopeThisUser($query) { return $query->where('user_id', auth()->id()); } public function canPay(): bool { return ! $this->isPaid() && ! $this->isOverdue(); } public function isPaid(): bool { return $this->paid_at !== null; } public function isOverdue(): bool { return $this->created_at->diffInDays(now()) > 1 && ! $this->isPaid(); } }