如何解决InvalidArgumentException路由[登录]未在Laravel 5.6中定义

问题描述 投票:0回答:3

我收到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 login routes invalidargumentexception
3个回答
4
投票

Laravel具有php artisan make:auth功能,如果您在终端中运行它,它将为您的应用程序生成auth脚手架。

请查看https://laravel.com/docs/5.6/authentication的文档


2
投票

在你的laravel应用程序中运行qazxsw poi到scaffold auth。


2
投票

清除可能有效的视图缓存

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.