what are routing parameters in laravel

 

They are used to put placeholders into route definition.Nice and tricky way for collecting URI segment.

1 <?php
2
3 // app/routes.php
4
5 // routes for the books section
6 Route::get(‘/teachers’, function()
7 {
8 return ‘teachers teach’;
9 });
10
11 Route::get(‘/teachers/{gender}’, function($gender)
{
return “teachers{$gender} in the class “;
14 });

//return “teachers{$gender} in the class “;
above line shows that {$gender} is used as placeholder as routing parameter .
Now if default value is set for $gender=male , if no one exists then there comes default value male ; if you want.