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

suddy's avatar
Level 1

Transferring data between back-end and front-end in Laravel-Inertia

Hi,

My question in a nutshell: “Is there a third way for transferring data between back-end and front-end except Inertia::render and shared data by HandleInertiaRequests? For just get some data from back-end without reload our Vue page again.”

My question in details: I watched Mr. Korop’s Laravel+Inertia full course in youtube (youtube com/watch?v=swelKdHlvco) and built that CRUD step by step and it worked perfectly. but I just think to myself, let make a really SAP CRUD and put all Create, Edit and Show in the Index page, just for practicing. I mean, a simple posts CRUD all in just 1 page.

So, I moved “create form” at the top of the index and it worked fine when adding new post, without refreshing page. but my problem is “edit page”.

My plan:

  1. I click on edit button (an edit form toggle out at top) ->
  2. Send post.id to back-end->
  3. Return full data (title, full content and writer) to front-end ->
  4. full data inserted in the edit form ->
  5. after submit edited data send to back-end
  6. ...

My problem is in step 3 and 4. in my posts controller:

public function edit(Request $request)
    {
        $post = Post::find($request->id);
        return Inertia::render('Posts/Index', compact('post'));
    }

If I return full data by Inertia::render to front-end so it doesn’t show my index list anymore. If I add "$posts = Post::all();" beside "$post"and send it to front-end it works but as performance view it's wrong because we shouldn't get posts list every time.

The correct way should be: posts list doesn't refresh, and just a post-id sent to back-end, then full post data return and placed in edit form. that's it.

Are there other ways except Inertia::render and "shared data" for sending data between front-end and back-end needless to get all posts from db and send it again to front-end?

What if I want to just reload an edit form part of my page and not all of it?

I have 5 years' experience in php but I'm new at JS and Vue, so sorry if my question is so noob.

Thank you all.

0 likes
6 replies
Sinnbeck's avatar

You can still just make regular ajax calls with axios and pass to vue/react. I do this in a few places

suddy's avatar
Level 1

@Sinnbeck Thank you my friend. axios is fine, but is there a way we do it just by inertia? I read somewhere that Inertia is enough for all our needs at front-end and we don't need other libraries or tools? Are you disagree?

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@suddy it can do 99% of what I need. If you are afraid of getting too much data, you can most likely get around it with the only prop. https://inertiajs.com/partial-reloads

But you can show your code and I might be better able to understand the problem

1 like
suddy's avatar
Level 1

@Sinnbeck My bad! I didn't read the "ADVENCED" part of Inertia docs. Partial reload is all I need.

Thank you!

And about that 1%, What is that? What you need in your app but Inertia doesn't support it?

Please or to participate in this conversation.