Move the model callbacks into Observables; reduce caching since it held balances incorrectly
This commit is contained in:
18
app/Models/Observers/SettingObserver.php
Normal file
18
app/Models/Observers/SettingObserver.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Observers;
|
||||
|
||||
use App\Models\Setting;
|
||||
|
||||
class SettingObserver
|
||||
{
|
||||
/**
|
||||
* @param Setting $model
|
||||
*/
|
||||
public function creating(Setting $model): void
|
||||
{
|
||||
if (!empty($model->id)) {
|
||||
$model->id = Setting::formatKey($model->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user