Skip to content

SubstituteBindings Middleware works only in route group #67

@f-liva

Description

@f-liva

Hello everyone, I need to understand why registering the binding substitution middleware at the API Group level while declaring the routes works, whereas if I register and declare it inside the Dingo configuration file it doesn't work.

It works:

> routes/api.php

$api = app('Dingo\Api\Routing\Router');

$api->version('v1', function ($api) {
    $api->group(['middleware' => \Illuminate\Routing\Middleware\SubstituteBindings::class], function($api) {
        $api->resource('countries', 'App\Http\Controllers\Api\CountryController');
    });
});

Doesn't work:

> config/api.php

/*
    |--------------------------------------------------------------------------
    | API Middleware
    |--------------------------------------------------------------------------
    |
    | Middleware that will be applied globally to all API requests.
    |
    */

    'middleware' => [
        \Illuminate\Routing\Middleware\SubstituteBindings::class,
    ],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions