inertia-laravel icon indicating copy to clipboard operation
inertia-laravel copied to clipboard

No cookie method with render?

Open Luke-SF opened this issue 2 years ago • 1 comments

As I understand it, Response should be able to add a cookie with withCookie(). https://www.tutsmake.com/laravel-cookies-get-set-delete-cookies/

However that is a bad call when trying that with Inertia:

return Inertia::render('MyView', $props)->withCookie($cookie);

gives an error:

Bad Method Call

Did you mean Inertia\Response::with() ?

Luke-SF avatar Mar 25 '22 19:03 Luke-SF

Good question! I couldn't find a way to set cookies when using Inertia::render.

thiagolcks avatar Jul 15 '22 14:07 thiagolcks

I am also looking for this. Did you find any way to do it?

mariomka avatar Mar 21 '23 10:03 mariomka

Ok, I found a way. Just use queue method from Cookie facade.

mariomka avatar Mar 21 '23 11:03 mariomka

Hey there,

We're closing this issue because it's inactive, already solved, old or not relevant anymore. Feel free to open up a new issue if you're still experiencing this problem.

jessarcher avatar Sep 08 '23 01:09 jessarcher