XF_Index/app/Http/Middleware/Authenticate.php

27 lines
634 B
PHP
Raw Normal View History

2023-06-10 14:21:40 +08:00
<?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;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
2023-06-11 14:20:56 +08:00
* @param \Illuminate\Http\Request $request
2023-06-10 14:21:40 +08:00
* @return string|null
*/
protected function redirectTo($request)
{
2023-06-11 14:20:56 +08:00
if (! $request->expectsJson()) {
2023-06-10 14:21:40 +08:00
return route('login');
}
}
}