我不知道我在这里做错了什么,只要我输入网址:localhost/project/public/auth/login
它会将我重定向到localhost/project/public/home
,因此我收到错误:NotFoundHttpException
这是我的路线:
// Authentication routes...
Route::get('/auth/login', 'Auth\AuthController@getLogin');
Route::post('/auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');
// Registration routes...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');
Route::controllers([
'password' => 'Auth\PasswordController',
]);
我已经在authController中添加了这些:
protected $redirectPath = "/adminportfolio";
protected $loginPath = 'auth/login';
protected $redirectAfterLogout = '/index';
请有人帮帮我..
答案 0 :(得分:0)
从中间件中找到RedirectIfAuthenticated文件,如下所示:
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
class RedirectIfAuthenticated
{
...
[----this file was truncated for simplicity----]
...
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return redirect('/home');
}
return $next($request);
}
}
您会注意到redirect('/home')
,您可能需要根据自己的需要进行更改。