2022-08-12 07:56:56 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
2022-11-06 11:28:22 +00:00
|
|
|
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
2022-08-12 07:56:56 +00:00
|
|
|
|
2022-11-06 11:28:22 +00:00
|
|
|
class Authenticate extends Middleware
|
2022-08-12 07:56:56 +00:00
|
|
|
{
|
|
|
|
/**
|
2022-11-06 11:28:22 +00:00
|
|
|
* Get the path the user should be redirected to when they are not authenticated.
|
2022-09-08 16:12:02 +00:00
|
|
|
*
|
2022-11-06 11:28:22 +00:00
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @return string|null
|
2022-09-08 16:12:02 +00:00
|
|
|
*/
|
2022-11-06 11:28:22 +00:00
|
|
|
// protected function redirectTo($request)
|
|
|
|
// {
|
|
|
|
// if (! $request->expectsJson()) {
|
|
|
|
// return route('login');
|
|
|
|
// }
|
|
|
|
// }
|
2022-09-08 16:12:02 +00:00
|
|
|
|
|
|
|
|
2022-11-06 11:28:22 +00:00
|
|
|
// public function handle($request, Closure $next, $guard = null)
|
|
|
|
// {
|
|
|
|
// $auth = $this->auth->guard($guard);
|
|
|
|
// if ($auth->guest()) {
|
|
|
|
// return $this->unauthorized('Unauthorized.');
|
|
|
|
// }
|
2022-09-08 16:12:02 +00:00
|
|
|
|
2022-11-06 11:28:22 +00:00
|
|
|
// $user = $this->auth->guard($guard)->user();
|
|
|
|
// if ($user->banned_at) {
|
|
|
|
// return $this->forbidden('您已被封禁,原因是: ' . $user->banned_reason ?? '一次或多次触犯了我们的规则。');
|
|
|
|
// }
|
2022-09-13 11:24:01 +00:00
|
|
|
|
2022-11-06 11:28:22 +00:00
|
|
|
// return $next($request);
|
|
|
|
// }
|
2022-08-12 07:56:56 +00:00
|
|
|
}
|