我收到InvalidArgumentException Route [login]未定义错误:
C:\ XAMPP \ htdocs中\购物\供应商\ laravel \框架的\ src \照亮\路由\ UrlGenerator.php
/**
* Get the URL to a named route.
*
* @param string $name
* @param mixed $parameters
* @param bool $absolute
* @return string
*
* @throws \InvalidArgumentException
*/
public function route($name, $parameters = [], $absolute = true)
{
if (! is_null($route = $this->routes->getByName($name))) {
return $this->toRoute($route, $parameters, $absolute);
}
throw new InvalidArgumentException("Route [{$name}] not defined.");
}
/**
* Get the URL for a given route instance.
*
* @param \Illuminate\Routing\Route $route
* @param mixed $parameters
* @param bool $absolute
* @return string
*
* @throws \Illuminate\Routing\Exceptions\UrlGenerationException
这是我的路线:
Route::group(['middleware' => ['auth']],function(){
route::get('/admin/dashboard','AdminController@dashboard');
});
这是我的方法:
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect('/home');
}
else{
return redirect()->action('AdminController@login')->with('success','please login to access');
}
return $next($request);
}
Laravel具有php artisan make:auth
功能,如果您在终端中运行它,它将为您的应用程序生成auth脚手架。
在你的laravel应用程序中运行qazxsw poi到scaffold auth。
清除可能有效的视图缓存