From 7679da380192e81d8a06663c895593f7c93e953a Mon Sep 17 00:00:00 2001 From: Wiktor-Wojciechowski <109503651+Wiktor-Wojciechowski@users.noreply.github.com> Date: Mon, 10 Jun 2024 13:38:31 +0200 Subject: [PATCH] added inertia middleware --- app/Http/Middleware/HandleInertiaRequests.php | 42 +++++++++++++++++++ bootstrap/app.php | 7 +++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 app/Http/Middleware/HandleInertiaRequests.php diff --git a/app/Http/Middleware/HandleInertiaRequests.php b/app/Http/Middleware/HandleInertiaRequests.php new file mode 100644 index 00000000..81c999cc --- /dev/null +++ b/app/Http/Middleware/HandleInertiaRequests.php @@ -0,0 +1,42 @@ + + */ + public function share(Request $request): array + { + return array_merge(parent::share($request), [ + // + ]); + } +} diff --git a/bootstrap/app.php b/bootstrap/app.php index 91570f99..43c2f5a7 100755 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -5,6 +5,7 @@ use Illuminate\Foundation\Application; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Middleware; +use App\Http\Middleware\HandleInertiaRequests; return Application::configure(basePath: dirname(__DIR__)) ->withRouting( @@ -12,7 +13,11 @@ commands: __DIR__ . "/../routes/console.php", health: "/up", ) - ->withMiddleware(function (Middleware $middleware): void { + ->withMiddleware(function (Middleware $middleware) { + $middleware->web(append: [ + HandleInertiaRequests::class, + ]); }) ->withExceptions(function (Exceptions $exceptions): void { })->create(); +