23 lines
481 B
PHP
23 lines
481 B
PHP
<?php
|
|
|
|
namespace Modules\Expense\Entities;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
class Expense extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $guarded = [];
|
|
|
|
public function category() {
|
|
return $this->belongsTo(ExpenseCategory::class, 'category_id', 'id');
|
|
}
|
|
|
|
public function getDateAttribute($value) {
|
|
return Carbon::parse($value)->format('d M, Y');
|
|
}
|
|
}
|