Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MatteoCDev's avatar

Inertia Fetch data from laravel api

Hello everyone i will try to explain my problem at best i can. Im using Laravel+Vue+Inertia

I have a page where a user can see the details of one production plan, in this page i need to show every item in this production and to get here no problem, i have a route that returns an Inertia::render with the array of items.

Once i display those items i need to also fetch all the components of the items and display them. After this i have one more layer of components.

My idea was to try and use Inertia::get but I'm not able to make it work.

Is this the right path or should i just preload all the data in the controller and then pass it down with Inertia::render all together?

Any other ideas?

Thanks in advance!

1 like
2 replies
Sinnbeck's avatar

Yeah that's correct. But if you don't need all data om first render you can lazy load it

2 likes
vincent15000's avatar

I'm not sure to understand all what you say.

You have a page to show the details / items of a production plan. But what are the components of the items ? Are you trying to say that when you click on an item, you have to load the components of this item on the same page as the production plan ?

If yes and if you use Inertia::get(), you will load a new page, that's probably not what you want to do. Perhaps the right way is to do partial reloads ?

https://inertiajs.com/partial-reloads

1 like

Please or to participate in this conversation.