0

Unlike here, I would like to hook a method into every request made to my web application. How would I do this?

Put in another way
There are some functionalities that I would want to be executed on whenever anybody checks on my web application. Most likely, I think I would put it in a method and call this method somewhere within Laravel. I don't want to write a daemon. I don't know how to do this. Please, help out. Drop a comment if you need more clarification.

1 Answer 1

3

Middleware is specifically designed to do this sort of thing. Define a middleware, then apply it globally, or to specific routes.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, although I had to do some more reading and experimentation with the docs...
Moreover, you will have specify what route/controller the middleware should work on, but service provider runs throughout the whole application

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.