lundi 22 octobre 2018

Using multiple Routes and Controllers on single blade file

I have created multiple controller and routes but they are working 1 at a time, I have to disable the other and change the code of my blade file or use different blade file for them but is there an easy way to use it.

The routes are

Route::get('/students/{alphabet}', 'PostController@showByAlphabet');
Route::get('/students/{name}', 'PostController@showByName');
Route::get('/students/{class}', 'PostController@showByClass');

I do not want to create different blade files like

http://example.com/students/alphabet/a
http://example.com/students/name/nadia
http://example.com/students/class/b_com

but like this

http://example.com/students/a
http://example.com/students/nadia
http://example.com/students/b_com

is it possible?

All controllers show different data.
1. Alphabet show list of students starting with same initial.
2. Name shows profile data of the student.
3. Class shows list of students in that subject class.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire