Laravel order of middleware (Middleware Priority). Multi-tenant using Postgres

允我心安 提交于 2019-12-04 19:02:19

I've found the solution, For this, there's something called $middlewarePriority in App\Kernel.

Adding this help me solve the problem.

/**
 * Responsible for prioritizing the middleware
 *
 * @var array
 */
protected $middlewarePriority = [
    \App\Http\Middleware\SwitchSchema::class,
];

I've got solution from this link.

https://github.com/laravel/framework/issues/19565

Have you tried wrapping your routes in the tenant group with another group? See if this works:

Route::group([
        'domain'     => '{tenant}.' . config('app.url'),
        'middleware' => 'select-schema'
    ],function () {
        Route::group(['middleware' => 'auth'], function () {
            Route::get('/', 'HomeController@index');
        });
    }
);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!