-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Problems using array parameters on Route::group() #33
Comments
I've got the "same" problem, now what you are looking for seems to work, but I tried to do:
and this fails... while it should works I guess. ref |
I am having the same problem |
Hello, I ran into this problem. Though I could have used middleware for each GET/POST... but to avoid code duplication I refactored my code from
to
hope it helps someone. |
What about refactoring it to this:
Got that idea from the best answer from the discussion here. PS: I haven't tested using |
I am getting this error when I change
to
even though this is what the documentation suggests. Full code:
|
@paddelboot add the namespace to the group, I think that will solve it... Try this: Route::group(['namespace'=>'Auth', 'middleware'=>'api', 'prefix' => 'auth'], function () {
Route::post('register', 'AuthController@register');
Route::post('login', 'AuthController@login');
Route::post('logout', 'AuthController@logout');
Route::post('refresh', 'AuthController@refresh');
Route::post('me', 'AuthController@me');
}); |
Hey there,
I'm having problems using parameters like 'middleware' on Route::group() facade static method,
And using param 'middleware' like this:
The error message is:
Symfony\Component\Debug\Exception\FatalErrorException: Illuminate\Routing\Router::loadRoutes(): Failed opening required 'Array' (include_path='.:/usr/share/php')
I'm aware that we can circumvent this problems by using middleware() on each post/get/method, but i was looking for a solution to avoid code duplication.
The text was updated successfully, but these errors were encountered: