diff --git a/bootstrap/app.php b/bootstrap/app.php index 7b162da..eb817df 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,18 +1,19 @@ withRouting( - web: __DIR__.'/../routes/web.php', - commands: __DIR__.'/../routes/console.php', - health: '/up', - ) - ->withMiddleware(function (Middleware $middleware) { - // - }) - ->withExceptions(function (Exceptions $exceptions) { - // - })->create(); + return Application::configure(basePath: dirname(__DIR__)) + ->withRouting(web: + __DIR__ . '/../routes/web.php', + commands: __DIR__ . '/../routes/console.php', + health: '/up' + ) + ->withMiddleware(function (Middleware $middleware) { + + }) + ->withExceptions(function (Exceptions $exceptions) { + // + }) + ->create(); diff --git a/composer.json b/composer.json index 83b4452..b848ce5 100644 --- a/composer.json +++ b/composer.json @@ -6,6 +6,7 @@ "license": "MIT", "require": { "php": "^8.2", + "diglactic/laravel-breadcrumbs": "^9.0", "joshbrw/laravel-module-installer": "^2.0", "laravel/framework": "^11.9", "laravel/tinker": "^2.9", diff --git a/config/breadcrumbs.php b/config/breadcrumbs.php new file mode 100644 index 0000000..dbca07c --- /dev/null +++ b/config/breadcrumbs.php @@ -0,0 +1,75 @@ + 'layouts.breadcrumbs', + + /* + |-------------------------------------------------------------------------- + | Breadcrumbs File(s) + |-------------------------------------------------------------------------- + | + | The file(s) where breadcrumbs are defined. e.g. + | + | - base_path('routes/breadcrumbs.php') + | - glob(base_path('breadcrumbs/*.php')) + | + */ + + 'files' => base_path('routes/breadcrumbs.php'), + + /* + |-------------------------------------------------------------------------- + | Exceptions + |-------------------------------------------------------------------------- + | + | Determine when to throw an exception. + | + */ + + // When route-bound breadcrumbs are used but the current route doesn't have a name (UnnamedRouteException) + 'unnamed-route-exception' => true, + + // When route-bound breadcrumbs are used and the matching breadcrumb doesn't exist (InvalidBreadcrumbException) + 'missing-route-bound-breadcrumb-exception' => true, + + // When a named breadcrumb is used but doesn't exist (InvalidBreadcrumbException) + 'invalid-named-breadcrumb-exception' => true, + + /* + |-------------------------------------------------------------------------- + | Classes + |-------------------------------------------------------------------------- + | + | Subclass the default classes for more advanced customisations. + | + */ + + // Manager + 'manager-class' => Diglactic\Breadcrumbs\Manager::class, + + // Generator + 'generator-class' => Diglactic\Breadcrumbs\Generator::class, + +]; diff --git a/resources/views/layouts/breadcrumbs.blade.php b/resources/views/layouts/breadcrumbs.blade.php new file mode 100644 index 0000000..40474b7 --- /dev/null +++ b/resources/views/layouts/breadcrumbs.blade.php @@ -0,0 +1,19 @@ +@unless ($breadcrumbs->isEmpty()) +
+ @foreach ($breadcrumbs as $breadcrumb) + @if (!is_null($breadcrumb->url) && !$loop->last) + + + {{ $breadcrumb->title }} + + + + @else + + {{ $breadcrumb->title }} + + @endif + + @endforeach +
+@endunless diff --git a/resources/views/layouts/header.blade.php b/resources/views/layouts/header.blade.php index 4b34b10..0463fe0 100644 --- a/resources/views/layouts/header.blade.php +++ b/resources/views/layouts/header.blade.php @@ -1,1357 +1,1360 @@ diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.php new file mode 100644 index 0000000..76bee07 --- /dev/null +++ b/routes/breadcrumbs.php @@ -0,0 +1,9 @@ +