Search code examples
laravellaravel-7slug

slug laravel override login


I have a route in web.php like this

Route::get('/{slug_category}', 'WelcomeController@cdetail')->name('cdetail');

its success when I access category like /action, /horror, etc

but this route was overridden my default /login laravel

how can I fix the /login route?

I already add if else in the controller, but I don't know what I must return to the login page

enter image description here


Solution

  • You can add your login route before your slug_category route

    Route::get('/login', ...);
    
    Route::get('/{slug_category}', 'WelcomeController@cdetail')->name('cdetail');
    

    Or if you use default laravel auth you can use like this.

    Auth::routes();
    
    Route::get('/{slug_category}', 'WelcomeController@cdetail')->name('cdetail');