From dbdadde542bef782cd8029e8638339228275ae93 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Fri, 6 Dec 2024 16:54:32 +0100 Subject: [PATCH] Add title and menu to Page component --- app/View/Page/Layout.php | 3 ++- app/View/Page/SettingLayout.php | 3 +-- modules/Dashboard/Components/DashboardComponent.php | 5 +---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/View/Page/Layout.php b/app/View/Page/Layout.php index 8619ee34..cda28627 100644 --- a/app/View/Page/Layout.php +++ b/app/View/Page/Layout.php @@ -7,9 +7,10 @@ use Illuminate\View\Component; class Layout extends Component { - public function __construct(public string $pageClass = '', public string $title = '') + public function __construct(public string $pageClass = '', public string $title = '', public string $menu = '') { session()->put('title', $title); + session()->put('menu', $menu); } public function userName(): string diff --git a/app/View/Page/SettingLayout.php b/app/View/Page/SettingLayout.php index 766592dd..442b6e13 100644 --- a/app/View/Page/SettingLayout.php +++ b/app/View/Page/SettingLayout.php @@ -18,13 +18,12 @@ class SettingLayout extends Component 'is_active' => get_class($setting) === $active, 'title' => $setting->title(), ])->toArray(); - session()->put('menu', 'setting'); } public function render() { return <<<'HTML' - + {{ $right ?? '' }} diff --git a/modules/Dashboard/Components/DashboardComponent.php b/modules/Dashboard/Components/DashboardComponent.php index a57f8504..16d1c2fe 100644 --- a/modules/Dashboard/Components/DashboardComponent.php +++ b/modules/Dashboard/Components/DashboardComponent.php @@ -12,16 +12,13 @@ class DashboardComponent extends Component public function mount(DashboardFactory $factory): void { - session()->put('menu', 'dashboard'); - session()->put('title', 'Dashboard'); - $this->blocks = $factory->load(); } public function render(): string { return <<<'HTML' - +
@foreach($this->blocks as $block)