Route [login] not defined

前端 未结 14 1888
無奈伤痛
無奈伤痛 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条回答
  • 2020-12-02 16:06

    If someone getting this from a rest client (ex. Postman) - You need to set the Header to Accept application/json.

    To do this on postman, click on the Headers tab, and add a new key 'Accept' and type the value 'application/json'.

    0 讨论(0)
  • 2020-12-02 16:07

    Am late to the party. if your expectation is some sort of json returned other than being redirected, then edit the exception handler so do just that.

    Go to go to App\Exceptions\Handler.php Then edit this code:

    public function render($request, Exception $exception)
        {
            return parent::render($request, $exception);
        }
    

    to

    public function render($request, Exception $exception)
        {
            return response()->json(
                [
                    'errors' => [
                        'status' => 401,
                        'message' => 'Unauthenticated',
                    ]
                ], 401
            );
        }
    
    0 讨论(0)
提交回复
热议问题