Reputation: 51
Do you think it's possible for a Laravel 6 Middleware to act as a before and after middleware at the same time? I don't see any restrictions about that but I can't find any examples.
Upvotes: 1
Views: 595
Reputation: 1
The previous answer didn't really provide any answers and instead explained basic middleware, so to sum it up for you a middleware only has one handle method that returns a single variable. So it is impossible to have before and after on the same middleware and you'd need two.
Upvotes: 0
Reputation: 50491
Yes ... all middleware can be both (the difference is conceptual). If you do things before the call to $next($request)
its a before middleware. If you do things after the call to $next($request)
it is an after middleware. It also can be a 3rd thing, a terminable middleware.
Upvotes: 1