Try that :
$group = $request->id
I have these routes
Route::group(['prefix' => '{id}/questions', 'middleware' => 'groupExists'], function(){
Route::post( '/', 'QuestionsController@create' );
Route::post( '/searches', 'QuestionsController@search' );
});
And I have this middleware intercepting them
class GroupExists implements Middleware{
public function handle($request, Closure $next) {
$group = Group::find($request->input('id')); // This is null
$groupNotFound = !$group;
if( $groupNotFound )
...
$request->input('id') is not working. How can I get the /{id}/ parameter of the route url?
Note: the id param is the id of a "group". These "questions" are related to a "group". The Route::group of the image is nested in another Route::group. The route is correct because it returns if I put a return "foo" in it.
Please or to participate in this conversation.