diff --git a/app/Http/Middleware/.gitkeep b/app/Http/Middleware/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/Http/Middleware/HandleInertiaRequests.php b/app/Http/Middleware/HandleInertiaRequests.php new file mode 100644 index 000000000..628a5a9e3 --- /dev/null +++ b/app/Http/Middleware/HandleInertiaRequests.php @@ -0,0 +1,44 @@ + + */ + public function share(Request $request): array + { + return [ + ...parent::share($request), + ]; + } +} diff --git a/bootstrap/app.php b/bootstrap/app.php index f7cdad1f5..781820d10 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use App\Http\Middleware\HandleInertiaRequests; use Illuminate\Foundation\Application; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Middleware; @@ -11,5 +12,9 @@ return Application::configure(basePath: dirname(__DIR__)) web: __DIR__.'/../routes/web.php', commands: __DIR__.'/../routes/console.php', ) - ->withMiddleware(function (Middleware $middleware): void {}) + ->withMiddleware(function (Middleware $middleware): void { + $middleware->web(append: [ + HandleInertiaRequests::class, + ]); + }) ->withExceptions(function (Exceptions $exceptions): void {})->create();