Authenticate.php
582 Bytes
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Jiannei\Response\Laravel\Support\Facades\Response;
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)
{
// if ($request->isJson()) {
Response::errorUnauthorized(); // 授权失败 401
// }
// return route('app');
}
}