phpvms/app/Models/Traits/ExpensableTrait.php

27 lines
441 B
PHP
Raw Normal View History

<?php
namespace App\Models\Traits;
use App\Models\Expense;
trait ExpensableTrait
{
2018-03-08 22:56:27 +08:00
public static function bootExpensableTrait()
{
}
/**
* Morph to Expenses.
* @return mixed
*/
public function expenses()
{
return $this->morphMany(
Expense::class,
'expenses', # overridden by the next two anyway
2018-04-02 03:32:01 +08:00
'ref_model',
'ref_model_id'
);
}
}