samedi 9 juin 2018

Creating longer path with routes and page controller in Laravel 5.6

I want to create a longer url or route like the following url: https://ift.tt/2sJXkMg. Mine would be website.test/shoes/shoe1.

For that I created a controller with a function that looks like this:

public function shoes() {
    return view('pages.shoes');
}

And for my route I have:

Route::get('/shoes', 'PagesController@shoes');

Now, I'd like to append shoes1 to shoes. I tried to do:

Route::get('/shoes/shoe1', 'PagesController@shoes');

but this did not work.

I am not sure if I can create another function in my Controller and make it work with my shoes() function. I also tried using Route Groups as shown in the documentation but I honestly do not think what they have there is helping my case. Perhaps Named Routes might work?

Your help will be highly appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire