Search code examples
laravelroutesslug

How to use slugs in routes


Is there a way to use slugs in my routes like instead domain/technicalInformation it would be domain/technical-information. Thank You!

PagesController.php

class PagesController extends Controller
{    
    public function technicalInformation(){
        return view('pages.technical-information');
    }
}

web.php

Route::get('/technicalInformation','ConsumerController@technicalInformation')->name('technical-information');

Solution

  • Well you just change to this and it should work.

    Route::get('/technical-information','ConsumerController@technicalInformation')->name('technical-information');