From c9b2dcdaf76acb7f2584d5a0c94fe61ede81619e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Tue, 6 Aug 2024 17:04:11 +0300 Subject: [PATCH] Added new event for menu create method.. --- app/Events/Menu/AdminCreating.php | 20 ++++++++++++++++++++ app/Events/Menu/NewwCreating.php | 20 ++++++++++++++++++++ app/Events/Menu/NotificationsCreating.php | 20 ++++++++++++++++++++ app/Events/Menu/PortalCreating.php | 20 ++++++++++++++++++++ app/Events/Menu/ProfileCreating.php | 20 ++++++++++++++++++++ app/Events/Menu/SettingsCreating.php | 20 ++++++++++++++++++++ app/Events/Menu/SettingsFinished.php | 20 ++++++++++++++++++++ app/Http/Livewire/Menu/Neww.php | 3 +++ app/Http/Livewire/Menu/Notifications.php | 3 +++ app/Http/Livewire/Menu/Profile.php | 3 +++ app/Http/Livewire/Menu/Settings.php | 6 ++++++ app/Http/Middleware/AdminMenu.php | 3 +++ app/Http/Middleware/PortalMenu.php | 3 +++ 13 files changed, 161 insertions(+) create mode 100644 app/Events/Menu/AdminCreating.php create mode 100644 app/Events/Menu/NewwCreating.php create mode 100644 app/Events/Menu/NotificationsCreating.php create mode 100644 app/Events/Menu/PortalCreating.php create mode 100644 app/Events/Menu/ProfileCreating.php create mode 100644 app/Events/Menu/SettingsCreating.php create mode 100644 app/Events/Menu/SettingsFinished.php diff --git a/app/Events/Menu/AdminCreating.php b/app/Events/Menu/AdminCreating.php new file mode 100644 index 000000000..733a896a8 --- /dev/null +++ b/app/Events/Menu/AdminCreating.php @@ -0,0 +1,20 @@ +menu = $menu; + } +} diff --git a/app/Events/Menu/NewwCreating.php b/app/Events/Menu/NewwCreating.php new file mode 100644 index 000000000..e3a2f7565 --- /dev/null +++ b/app/Events/Menu/NewwCreating.php @@ -0,0 +1,20 @@ +menu = $menu; + } +} diff --git a/app/Events/Menu/NotificationsCreating.php b/app/Events/Menu/NotificationsCreating.php new file mode 100644 index 000000000..9b09aa937 --- /dev/null +++ b/app/Events/Menu/NotificationsCreating.php @@ -0,0 +1,20 @@ +notifications = $notifications; + } +} diff --git a/app/Events/Menu/PortalCreating.php b/app/Events/Menu/PortalCreating.php new file mode 100644 index 000000000..ccd858e05 --- /dev/null +++ b/app/Events/Menu/PortalCreating.php @@ -0,0 +1,20 @@ +menu = $menu; + } +} diff --git a/app/Events/Menu/ProfileCreating.php b/app/Events/Menu/ProfileCreating.php new file mode 100644 index 000000000..e730a8630 --- /dev/null +++ b/app/Events/Menu/ProfileCreating.php @@ -0,0 +1,20 @@ +menu = $menu; + } +} diff --git a/app/Events/Menu/SettingsCreating.php b/app/Events/Menu/SettingsCreating.php new file mode 100644 index 000000000..2c3d154f2 --- /dev/null +++ b/app/Events/Menu/SettingsCreating.php @@ -0,0 +1,20 @@ +menu = $menu; + } +} diff --git a/app/Events/Menu/SettingsFinished.php b/app/Events/Menu/SettingsFinished.php new file mode 100644 index 000000000..ae84b5988 --- /dev/null +++ b/app/Events/Menu/SettingsFinished.php @@ -0,0 +1,20 @@ +menu = $menu; + } +} diff --git a/app/Http/Livewire/Menu/Neww.php b/app/Http/Livewire/Menu/Neww.php index 30f755339..3f4a9984c 100644 --- a/app/Http/Livewire/Menu/Neww.php +++ b/app/Http/Livewire/Menu/Neww.php @@ -3,6 +3,7 @@ namespace App\Http\Livewire\Menu; use App\Events\Menu\NewwCreated; +use App\Events\Menu\NewwCreating; use Illuminate\Contracts\View\View; use Illuminate\Support\Str; use Livewire\Component; @@ -24,6 +25,8 @@ class Neww extends Component menu()->create('neww', function ($menu) { $menu->style('tailwind'); + event(new NewwCreating($menu)); + event(new NewwCreated($menu)); foreach($menu->getItems() as $item) { diff --git a/app/Http/Livewire/Menu/Notifications.php b/app/Http/Livewire/Menu/Notifications.php index d391a3017..9aa0c8ebc 100644 --- a/app/Http/Livewire/Menu/Notifications.php +++ b/app/Http/Livewire/Menu/Notifications.php @@ -3,6 +3,7 @@ namespace App\Http\Livewire\Menu; use App\Events\Menu\NotificationsCreated; +use App\Events\Menu\NotificationsCreating; use Illuminate\Contracts\View\View; use Illuminate\Notifications\DatabaseNotification; use Illuminate\Support\Str; @@ -88,6 +89,8 @@ class Notifications extends Component $notifications->notifications = collect(); $notifications->keyword = $this->keyword; + event(new NotificationsCreating($notifications)); + event(new NotificationsCreated($notifications)); $rows = []; diff --git a/app/Http/Livewire/Menu/Profile.php b/app/Http/Livewire/Menu/Profile.php index 61adbee96..503de4d89 100644 --- a/app/Http/Livewire/Menu/Profile.php +++ b/app/Http/Livewire/Menu/Profile.php @@ -3,6 +3,7 @@ namespace App\Http\Livewire\Menu; use App\Events\Menu\ProfileCreated; +use App\Events\Menu\ProfileCreating; use Illuminate\Contracts\View\View; use Livewire\Component; @@ -15,6 +16,8 @@ class Profile extends Component menu()->create('profile', function ($menu) { $menu->style('tailwind'); + event(new ProfileCreating($menu)); + event(new ProfileCreated($menu)); foreach($menu->getItems() as $item) { diff --git a/app/Http/Livewire/Menu/Settings.php b/app/Http/Livewire/Menu/Settings.php index 4105b9555..edd10e0e4 100644 --- a/app/Http/Livewire/Menu/Settings.php +++ b/app/Http/Livewire/Menu/Settings.php @@ -3,6 +3,8 @@ namespace App\Http\Livewire\Menu; use App\Events\Menu\SettingsCreated; +use App\Events\Menu\SettingsCreating; +use App\Events\Menu\SettingsFinished; use Illuminate\Contracts\View\View; use Illuminate\Support\Str; use Livewire\Component; @@ -26,6 +28,7 @@ class Settings extends Component menu()->create('settings', function ($menu) { $menu->style('tailwind'); + event(new SettingsCreating($menu)); event(new SettingsCreated($menu)); $this->addSettingsOfModulesFromJsonFile($menu); @@ -41,6 +44,9 @@ class Settings extends Component $menu->removeByTitle($item->title); } + + #todo event name must be changed to SettingsCreated + event(new SettingsFinished($menu)); }); return view('livewire.menu.settings'); diff --git a/app/Http/Middleware/AdminMenu.php b/app/Http/Middleware/AdminMenu.php index 451f2521d..d644f24a3 100644 --- a/app/Http/Middleware/AdminMenu.php +++ b/app/Http/Middleware/AdminMenu.php @@ -3,6 +3,7 @@ namespace App\Http\Middleware; use App\Events\Menu\AdminCreated; +use App\Events\Menu\AdminCreating; use Closure; class AdminMenu @@ -24,6 +25,8 @@ class AdminMenu menu()->create('admin', function ($menu) { $menu->style('tailwind'); + event(new AdminCreating($menu)); + event(new AdminCreated($menu)); }); diff --git a/app/Http/Middleware/PortalMenu.php b/app/Http/Middleware/PortalMenu.php index 9150b1f62..5ee517677 100644 --- a/app/Http/Middleware/PortalMenu.php +++ b/app/Http/Middleware/PortalMenu.php @@ -3,6 +3,7 @@ namespace App\Http\Middleware; use App\Events\Menu\PortalCreated; +use App\Events\Menu\PortalCreating; use Closure; class PortalMenu @@ -24,6 +25,8 @@ class PortalMenu menu()->create('portal', function ($menu) { $menu->style('tailwind'); + event(new PortalCreating($menu)); + event(new PortalCreated($menu)); });