From 0c3d21163a33246bd84616c6e54f19bcf0a99ea9 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Wed, 4 Dec 2024 02:03:21 +0330 Subject: [PATCH] fixed bug setting first time by observer --- app/Observers/SettingObsever.php | 50 ++++++++++++++++++++++++++++ app/Providers/AppServiceProvider.php | 3 ++ 2 files changed, 53 insertions(+) create mode 100644 app/Observers/SettingObsever.php diff --git a/app/Observers/SettingObsever.php b/app/Observers/SettingObsever.php new file mode 100644 index 0000000..593e76c --- /dev/null +++ b/app/Observers/SettingObsever.php @@ -0,0 +1,50 @@ +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 + { + // + } +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index f5c6967..f9aa019 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -6,7 +6,9 @@ use App\Helpers\TDate; use App\Http\Middleware\Acl; use App\Models\Area; use App\Models\Part; +use App\Models\Setting; use App\Observers\PartObsever; +use App\Observers\SettingObsever; use Carbon\Carbon; use Illuminate\Pagination\Paginator; use Illuminate\Support\Facades\Blade; @@ -62,6 +64,7 @@ class AppServiceProvider extends ServiceProvider }); Part::observe(PartObsever::class); + Setting::observe(SettingObsever::class); }