vendredi 25 septembre 2020

How to attach middleware to an existing named route from a package in laravel 5?

I'm trying to extend an existing application without modifying its source code. The application has a named route called wizard-add. Is there a way to register \MyPackage\MyMiddleware with the existing route? I tried attaching it via Route::getRoutes()->getByName('wizard-add')->middleware(\MyPackage\MyMiddleware::class); but since packages are registered before the routes are read, Route::getRoutes() returns an empty collection.

Thank you!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire