InterNACHI/modular

[Question] Web middleware

robsontenorio opened this issue ยท 4 comments

Hi!

On my default laravel "top level app" I have such kernel/http middleware.

 protected $middlewareGroups = [
        'web' => [
         ...
            \App\Http\Middleware\HandleInertiaRequests::class,
        ],

I just noticed this is only applied to "top level app", it does not have effect on app-modules.

Is there any special config do I need? This such thing should not working out of box?

Ok, just set middleware('web') group on yyy-routes.php file and it works. Is that expected?

Route::middleware('web')->group(function () {
   // my modules routes
});

Yep, you need to set the middleware as a group for your modules. It's an interesting point, though. I'm not sure if it makes sense for modules to pick up the default middleware groups in your RouteServiceProvider. It's something I'll keep an eye out for and maybe consider if other people get caught off guard by that.

I'd suggest adding a note on that to the readme.

I'd suggest adding a note on that to the readme.

Agree with you. I took more than one hour to figure out that.
@inxilpro