Answer the question
In order to leave comments, you need to log in
Authentication in Lumen: Middleware vs Provider?
For authentication, the Lumen documentation suggests using a Provider. At the same time, Middleware is also used.
In the Provider, you need to implement getting the user from the database, and in the Middleware, just check the user and make a response if the user is not found.
Why not combine work in Middleware ?
What practical purpose does a Service Provider serve ?
Answer the question
In order to leave comments, you need to log in
Why not combine work in Middleware?
Because it's called HTTP Middleware . Those. midlaveyr knows nothing about your database, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question