fixed bug setting first time by observer

master
A1Gard 3 weeks ago
parent c55c8665d2
commit 0c3d21163a

@ -0,0 +1,50 @@
<?php
namespace App\Observers;
use App\Models\Setting;
class SettingObsever
{
/**
* Handle the Setting "created" event.
*/
public function created(Setting $setting): void
{
//
$setting->raw = $setting->value;
$setting->save();
}
/**
* Handle the Setting "updated" event.
*/
public function updated(Setting $setting): void
{
//
}
/**
* Handle the Setting "deleted" event.
*/
public function deleted(Setting $setting): void
{
//
}
/**
* Handle the Setting "restored" event.
*/
public function restored(Setting $setting): void
{
//
}
/**
* Handle the Setting "force deleted" event.
*/
public function forceDeleted(Setting $setting): void
{
//
}
}

@ -6,7 +6,9 @@ use App\Helpers\TDate;
use App\Http\Middleware\Acl; use App\Http\Middleware\Acl;
use App\Models\Area; use App\Models\Area;
use App\Models\Part; use App\Models\Part;
use App\Models\Setting;
use App\Observers\PartObsever; use App\Observers\PartObsever;
use App\Observers\SettingObsever;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Pagination\Paginator; use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Blade;
@ -62,6 +64,7 @@ class AppServiceProvider extends ServiceProvider
}); });
Part::observe(PartObsever::class); Part::observe(PartObsever::class);
Setting::observe(SettingObsever::class);
} }

Loading…
Cancel
Save