Move the model callbacks into Observables; reduce caching since it held balances incorrectly

This commit is contained in:
Nabeel Shahzad
2018-03-18 20:37:35 -05:00
parent 6b002f24a8
commit 36ea12e135
25 changed files with 336 additions and 266 deletions

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Models\Observers;
use App\Models\PirepField;
/**
* Class PirepFieldObserver
* @package App\Models\Observers
*/
class PirepFieldObserver
{
/**
* @param PirepField $model
*/
public function creating(PirepField $model): void
{
$model->slug = str_slug($model->name);
}
/**
* @param PirepField $model
*/
public function updating(PirepField $model): void
{
$model->slug = str_slug($model->name);
}
}