laravel访问需要登陆的页面,如果当前未登陆,出现如下错误:
Route [login] not defined.
如何解决,只需要在路由中命名即可
增加login路由
在web.php中给你的Login登录路由设置login名字:
```
Route::group(['prefix' => 'admin'], function () {
Route::get('/login', '\App\Http\Controllers\Admin\LoginController@index')->name('login');
Route::post('/login', '\App\Http\Controllers\Admin\LoginController@login');
Route::get('/logout', '\App\Http\Controllers\Admin\LoginController@logout')->name('logout');
Route::group(['middleware' => 'auth:admin'], function () {
// 后台首页
Route::get('/home', '\App\Http\Controllers\Admin\HomeController@index');
});
});
```