The parameter is posted to some_name
like this:
{{ route('some_name', $id = '1'}}
How can I access it in the if condition?
Route::group(['prefix' => '/'], function()
{
if ( condition )
{
Route::get('/route/{id}', 'ControllerA@methodA')->name('some_name');
} else{
Route::get('/route{id}', 'ControllerB@methodB')->name('some_name');;
}
});
How can I use the {id}
parameter in the if (condition)
?
I tried
Route::group(['prefix' => '/'], function($id)
{
if ( $id == 1)
And it's not working.