esbenp / esbenp/larapi

Problems using array parameters on Route::group()

Open
#33 7 comments 8 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
399
Forks
114
PR merge metrics
No merged PRs in 30d

Description

Hey there,

I'm having problems using parameters like 'middleware' on Route::group() facade static method,

And using param 'middleware' like this:
```php
Route::group(['middleware' => 'role:admin'], function () {
Route::post('create','AppointmentController@create');
});
```

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.