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