Root0x
Root0x

Reputation: 490

Inertia.JS Render View To String

I have a laravel jetstream application where I would like to render a vue view into a html string which i will then process elsewhere.

I would like to have

$htmlStr = Inertia::render('Claims/Show', ['claim' => $claim,  'permissions' => $permissions]);

Is there a way to render inertia templates as a string?

Upvotes: 1

Views: 885

Answers (2)

anony253
anony253

Reputation: 11

Yes, it is possible, try this

$htmlStr = Inertia::render('Claims/Show', ['claim' => $claim,  'permissions' => $permissions])->toResponse(new \Illuminate\Http\Request());

Upvotes: 1

Ferry Kranenburg
Ferry Kranenburg

Reputation: 2635

No, not possible. It renderes a view response that cannot be converted to a html string.

Upvotes: 1

Related Questions