Remove subfleet_expenses and combine into main expenses table; select expense type on subfleet #130 #136
This commit is contained in:
28
app/Models/Traits/Expensable.php
Normal file
28
app/Models/Traits/Expensable.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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__);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user