Route [login] not defined

前端 未结 14 1900
無奈伤痛
無奈伤痛 2020-12-02 15:15

Trying to play with Laravel today for the first time. I am getting the following error when I attempt to visit localhost/project/public:

InvalidArgume

14条回答
  •  猫巷女王i
    2020-12-02 15:47

    **Adding this for the future me.**
    I encountered this because I was reusing Laravel's "HomeController", and adding my custom functions to it. Note that this controller calls the auth middleware in its __construct() method as shown below, which means that all functions must be authenticated. No wonder it tries to take you to login page first. So, if you are not using Laravel's authentication scafffolding, you will be in a mess. Disable the constructor, or do as you seem fit, now that you know what is happening.

    public function __construct()
    {
        $this->middleware('auth');
    }
    
    

提交回复
热议问题