M
M
Maqsat Batyrqul2015-12-08 10:20:46
Laravel
Maqsat Batyrqul, 2015-12-08 10:20:46

Why do we need terminable middleware?

I'm reading the documentation and I came across TERMINABLE MIDDLEWARE, I can't figure out what it is.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2015-12-08
@alexey-m-ukolov

Sometimes a middleware may need to do some work after the HTTP response has already been sent to the browser. For example, the "session" middleware included with Laravel writes the session data to storage after the response has been sent to the browser. To accomplish this, define the middleware as "terminable" by adding a terminate method to the middleware.
What's incomprehensible here? Sometimes some actions need to be performed after the response is given to the browser (for example, to perform some resource-intensive operations that are not directly related to the response) - this is what they are used for.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question