From c89103adfa2483518bafb52b68686b8375d142de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=2E=20Nagy=20Gerg=C5=91?= Date: Sun, 26 Nov 2023 15:17:23 +0100 Subject: [PATCH] breadcrumbs wip --- .../components/layout/breadcrumbs.blade.php | 15 ++++---- src/Root.php | 2 ++ src/View/Components/Layout/Breadcrumbs.php | 34 +++++++++++++++++++ 3 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 src/View/Components/Layout/Breadcrumbs.php diff --git a/resources/views/components/layout/breadcrumbs.blade.php b/resources/views/components/layout/breadcrumbs.blade.php index 870d5f180..4aabbcd78 100644 --- a/resources/views/components/layout/breadcrumbs.blade.php +++ b/resources/views/components/layout/breadcrumbs.blade.php @@ -1,8 +1,11 @@ diff --git a/src/Root.php b/src/Root.php index d80ddd8c6..8dd5ff094 100644 --- a/src/Root.php +++ b/src/Root.php @@ -83,6 +83,8 @@ public function boot(): void foreach ($this->booting as $callback) { call_user_func_array($callback, [$this]); } + + $this->breadcrumbs->pattern($this->getPath(), __('Dashboard')); } /** diff --git a/src/View/Components/Layout/Breadcrumbs.php b/src/View/Components/Layout/Breadcrumbs.php new file mode 100644 index 000000000..46d8caff2 --- /dev/null +++ b/src/View/Components/Layout/Breadcrumbs.php @@ -0,0 +1,34 @@ +request = $request; + } + + /** + * Get the view / view contents that represent the component. + */ + public function render(): View + { + return $this->view('root::components.layout.breadcrumbs', [ + 'breadcrumbs' => Root::instance()->breadcrumbs->resolve($this->request), + ]); + } +}