lucidarch/laravel

How to use a middleware inside src/Services/SomeService/Http/Middleware folder?

Closed this issue · 3 comments

pcova commented

Hi, I created a middleware that is inside the src/Services/MyService/Http/Middleware folder, but when I try to use it the application says

Class Framework\Http\Middleware\Something does not exist

Is this supposed to happen? The Service is registered on src/Foundation/ServiceProvider.php, is it necessary to do anything else in order to use the middlewares?

Thanks.
And by the way, good job with this repository it is an excellent idea.

Hello,

It seems like you haven't pulled the correct namespace for your middleware.

Could you please tell me in which namespace your middleware is placed under?

Thanks

pcova commented

@meletisf you are correct, I had the wrong Namespace.

I had Framework\Http\Middleware instead of App\Services\MyService\Http\Middleware

Thank you and sorry for the inconvenience.

No problem. Always happy to help.