E
E
EVOSandru62018-12-02 01:15:53
Laravel
EVOSandru6, 2018-12-02 01:15:53

How to fix login route in Laravel 5.7 middleware auth?

Hi guys,
How to fix InvalidArgumentException Route [login] not defined. ?
Initially Laravel 5.6 , updated to 5.7. But it didn't help. I deleted all the files where the word login is mentioned, but the problem remains. I pulled the Authenticate class from the new version of the neighboring project , where the method is specified:

protected function redirectTo($request)
    {
        return route('login');
    }

The fix didn't help.
The reason is in the routes/web.php file on the middleware -
Route::group([
    'prefix' => 'provider',
    'as' => 'provider.',
    'namespace' => 'Provider',
     'middleware' => ['auth', 'can:'.GatesHelper::PROVIDER_MANAGE],
],

So far, only this sticky helps:
Route::get('/login',function () {
    return redirect(route('phone.login'));
})->name('login');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
energimass, 2018-12-04
@energimass

The problem is that somewhere in the view there is a link or a form action to {{ route('login') }} that is not defined in your web.php file, you need to fix it, or give the route a name - name('login' ) or [name=>login].

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question