mercredi 31 octobre 2018

Why only first controller is working in Laravel

I have 2 Controllers in Laravel as

Route::get('/books/{slug}', 'BooksController@slugShow');
Route::get('/books/{alphabet}', 'BooksController@showByAlphabet');

Both controllers are working fine when using only one but when I put them both in Routs file only the first one works.

slug urls are like

https://www.example.com/books/once_upon_a_time

and Alphabets urls are list of books starting with an alphabet

https://www.example.com/books/a

How Can I make them both work and I also want urls of alphabets to not work if there are more than a single character in the url like

https://www.example.com/books/aa
or
https://www.example.com/books/once



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire