Inertia
Passing globally needed data in HandleInertiaRequests middleware
2
161
Solved

whoami

Started this discussion 1 month ago

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?

Best answer

alex

Replied 1 month ago

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

Replied 1 month ago

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