Raff
Raff

Reputation: 71

Route Not Found Exception Route [login] not defined

In my Laravel 7.0 project, though I have login routes but still application gives an error

Symfony\Component\Routing\Exception\RouteNotFoundException Route [login] not defined.

web.php

Route::prefix('admin')->middleware('auth')->group(function() {
Route::get('/', 'AuthController@home');
Route::get('login', 'AuthController@index');
Route::post('post-login', 'AuthController@postLogin'); 
Route::get('logout', 'AuthController@logout');
Route::resource('mobile-series', 'MobileSeriesController');
Route::get('mobile-series-status-update/{id}', 'MobileSeriesController@statusUpdate');
Route::resource('mobile_series_versions', 'MobileSeriesVersionController');
});

I have also applied Route::post('login', [ 'as' => 'login', 'uses' => 'AuthController@index']);

But after using this my application gives error

This page isn’t working. localhost redirected you too many times.

How to solve this? Anybody help please?

Upvotes: 0

Views: 8607

Answers (1)

Lateh Larry
Lateh Larry

Reputation: 44

Try getting an overview of all your routes using this command php artisan route:list. Normally I believe your routes should look like this;

Route::get('/login', 'AuthController@index')->name('login'); OR
Route::get('/login', [AuthController::class, 'index'])->name('login');

Upvotes: 0

Related Questions