diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 42cf574c8..613fd2ce1 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -14,12 +14,12 @@ class Kernel extends HttpKernel * @var array */ protected $middleware = [ + \App\Http\Middleware\TrustProxies::class, + \Fruitcake\Cors\HandleCors::class, \App\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, - \App\Http\Middleware\TrustProxies::class, - \Fruitcake\Cors\HandleCors::class, \App\Http\Middleware\SetLocale::class, ]; @@ -30,18 +30,22 @@ class Kernel extends HttpKernel */ protected $middlewareGroups = [ 'web' => [ - // \App\Http\Middleware\EncryptCookies::class, - // \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, - // \Illuminate\Session\Middleware\StartSession::class, + \App\Http\Middleware\EncryptCookies::class, + \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, + \Illuminate\Session\Middleware\StartSession::class, // \Illuminate\Session\Middleware\AuthenticateSession::class, - // \Illuminate\View\Middleware\ShareErrorsFromSession::class, - // \App\Http\Middleware\VerifyCsrfToken::class, + \Illuminate\View\Middleware\ShareErrorsFromSession::class, + \App\Http\Middleware\VerifyCsrfToken::class, + \Illuminate\Routing\Middleware\SubstituteBindings::class, + ], + + 'spa' => [ \Illuminate\Routing\Middleware\SubstituteBindings::class, ], 'api' => [ 'throttle:60,1', - 'bindings', + \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ]; @@ -59,6 +63,7 @@ class Kernel extends HttpKernel 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, + 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 548e4be7b..bc27c0b56 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -39,6 +39,8 @@ public function map() $this->mapWebRoutes(); + $this->mapSpaRoutes(); + // } @@ -70,4 +72,18 @@ protected function mapApiRoutes() ->namespace($this->namespace) ->group(base_path('routes/api.php')); } + + /** + * Define the "spa" routes for the application. + * + * These routes are typically stateless. + * + * @return void + */ + protected function mapSpaRoutes() + { + Route::middleware('spa') + ->namespace($this->namespace) + ->group(base_path('routes/spa.php')); + } } diff --git a/routes/spa.php b/routes/spa.php new file mode 100644 index 000000000..09cc498fb --- /dev/null +++ b/routes/spa.php @@ -0,0 +1,18 @@ +where('path', '(.*)'); diff --git a/routes/web.php b/routes/web.php index 6c75e7652..58e9d8d99 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,7 +1,5 @@