Lifetime access is $100 off. Ends this week.Join here →

Passing globally needed data in HandleInertiaRequests middleware

Just curious about this one.

When you want to pass data that you want to be globally available in your Inertia Vue app, is it a good practice to pass it in HandleInertiaRequests middleware?

If we do that, are we implementing something like a View Composer?

whoami (Daryl)
whoami (Daryl)
0
2
356
alex
alex
Moderator
Solution

Yeah it’s similar to a view composer, but you can control what gets loaded in with the ‘only’ array when making Inertia requests.

Let me know if you need any more advice for your specific use case!

whoami (Daryl)
whoami (Daryl)

Thanks, Alex. I learned about only from your Learn Inertia series 🎉