このリポジトリは2023-09-09にアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュ、イシューの作成、プルリクエストはできません。
kikikan/backend/app/Http/Middleware/Authenticate.php

30 行
698 B
PHP
Raw 通常表示 履歴

2021-08-03 15:34:15 +09:00
<?php
namespace App\Http\Middleware;
use Closure;
2021-08-03 15:34:15 +09:00
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request) {
2021-08-03 15:34:15 +09:00
if (! $request->expectsJson()) {
return route('login');
}
}
public function handle ($request, Closure $next, ...$guard) {
2021-10-30 23:13:12 +09:00
if (!$request->session()->has($guard)) {
return redirect(route($guard[0].'login'));
}
return $next($request);
}
2021-08-03 15:34:15 +09:00
}