28 lines
643 B
PHP
28 lines
643 B
PHP
|
<?php
|
||
|
/*
|
||
|
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||
|
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||
|
* https://www.x-lf.com/
|
||
|
*/
|
||
|
|
||
|
namespace App\Http\Middleware;
|
||
|
|
||
|
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||
|
use Illuminate\Http\Request;
|
||
|
|
||
|
class Authenticate extends Middleware
|
||
|
{
|
||
|
/**
|
||
|
* Get the path the user should be redirected to when they are not authenticated.
|
||
|
*
|
||
|
* @param Request $request
|
||
|
* @return string|null
|
||
|
*/
|
||
|
protected function redirectTo($request)
|
||
|
{
|
||
|
if (!$request->expectsJson()) {
|
||
|
return route('login');
|
||
|
}
|
||
|
}
|
||
|
}
|