phpvms/app/Models/Traits/Expensable.php

29 lines
558 B
PHP

<?php
namespace App\Models\Traits;
use App\Models\Expense;
trait Expensable
{
/**
* Initialize a new journal when a new record is created
*/
public static function bootExpensable()
{
/*static::created(function ($model) {
$model->initJournal(config('phpvms.currency'));
});*/
}
/**
* Morph to Expenses.
* @return mixed
*/
public function expenses()
{
return $this->hasMany(Expense::class, 'ref_class_id')
->where('ref_class', __CLASS__);
}
}