Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Child/Inner route not inheriting parent middlware(s) #1752

Open
jariesdev opened this issue Sep 30, 2020 · 1 comment
Open

Child/Inner route not inheriting parent middlware(s) #1752

jariesdev opened this issue Sep 30, 2020 · 1 comment
Labels
help wanted lumen related to Lumen specifically (ie. not an issue in Laravel)

Comments

@jariesdev
Copy link

Q A
Bug? yes
New Feature? no
Framework Lumen
Framework version 7.0
Package version 3.0.0
PHP version 7.2

Actual Behaviour

Dingo child/inner route middleware not "inherit" parent's middleware.

Expected Behaviour

The child routes should append middlware define from the parent as its own middlware.

Steps to Reproduce

use Dingo\Api\Routing\Router;

$api->group([
    'prefix' => 'foo',
    'middleware' => ['auth:api'],
], function (Router $api) {

    $api->get('/test', [
        'uses' => 'ExampleController@test'
    ]);

    $api->get('/bar', [
        'uses' => 'ExampleController@bar',
        'middleware' => ['employee'],
    ]);

    $api->get('/biz', [
        'uses' => 'ExampleController@biz',
        'middleware' => ['employer'],
    ]);

  ]);

/test has auth:api middlware
foo/bar has employee middlware but it should auth:api and employee
foo/biz has employee middlware but it should auth:api and employer

Possible Solutions

Currently what i'm doing is write the full middlware on every child 'middleware' => ['auth:api','employer'], or moving it outside the group.

@specialtactics
Copy link
Member

Not really sure as I don't use Lumen, but this is definitely a very basic functionality that I have never seen not work (ie. inheriting parent middleware).

There are definitely some Lumen users here, so hopefully someone can have a look at this for you.

@specialtactics specialtactics added help wanted lumen related to Lumen specifically (ie. not an issue in Laravel) labels Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted lumen related to Lumen specifically (ie. not an issue in Laravel)
Projects
None yet
Development

No branches or pull requests

2 participants