'decimal:2', 'amount_usd' => 'decimal:2', 'original_amount' => 'decimal:2', 'expense_date' => 'date', 'approval_date' => 'datetime', 'approved_at' => 'datetime', ]; public function tenant() { return $this->belongsTo(Tenant::class); } public function project() { return $this->belongsTo(Project::class); } public function pettyCash() { return $this->belongsTo(PettyCash::class); } public function employee() { return $this->belongsTo(Employee::class); } public function currency() { return $this->belongsTo(Currency::class); } public function requestedBy() { return $this->belongsTo(User::class, 'requested_by'); } public function approvedBy() { return $this->belongsTo(User::class, 'approved_by'); } /** * Alias for approvedBy (backward compatibility). */ public function approver() { return $this->approvedBy(); } /** * Scope: filter by category. */ public function scopeByCategory($query, $category) { return $query->where('category', $category); } /** * Scope: filter by status. */ public function scopeByStatus($query, $status) { return $query->where('status', $status); } /** * Get the status label for display. */ public function getStatusLabelAttribute(): string { return [ 'pending' => __('expense.pending'), 'approved' => __('expense.approved'), 'rejected' => __('expense.rejected'), 'paid' => __('expense.paid'), ][$this->status] ?? $this->status; } }