28 lines
558 B
PHP
28 lines
558 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Expense extends Model
|
|
{
|
|
protected $fillable = [
|
|
'date', 'branch_id', 'expense_category_id', 'expense_type', 'amount', 'remarks', 'batch_id'
|
|
];
|
|
|
|
public function branch()
|
|
{
|
|
return $this->belongsTo(Branch::class);
|
|
}
|
|
|
|
public function category()
|
|
{
|
|
return $this->belongsTo(ExpenseCategory::class, 'expense_category_id');
|
|
}
|
|
|
|
public function account()
|
|
{
|
|
return $this->morphOne(Account::class, 'accountable');
|
|
}
|
|
}
|