Ask Your Question
3

What is the distinction between terminable middleware and after middleware in Laravel?

asked 2022-09-10 11:00:00 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-07-13 15:00:00 +0000

bukephalos gravatar image

In Laravel, terminable middleware are executed after the HTTP response has been sent to the client, while after middleware are executed before the response is sent to the client.

Terminable middleware can perform tasks that should occur after a response has been sent, such as logging or sending notifications. They are registered using the terminate method in the middleware class.

On the other hand, after middleware can modify the response before it is sent to the client. They are registered similarly to other middleware, but with a lower priority than other middleware.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-09-10 11:00:00 +0000

Seen: 13 times

Last updated: Jul 13 '22