2018-03-19 09:37:35 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Observers;
|
|
|
|
|
|
|
|
use App\Models\Setting;
|
|
|
|
|
2018-03-20 09:50:40 +08:00
|
|
|
/**
|
|
|
|
* Class SettingObserver
|
|
|
|
*/
|
2018-03-19 09:37:35 +08:00
|
|
|
class SettingObserver
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @param Setting $model
|
|
|
|
*/
|
|
|
|
public function creating(Setting $model): void
|
|
|
|
{
|
|
|
|
if (!empty($model->id)) {
|
|
|
|
$model->id = Setting::formatKey($model->id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|