How to set cookies

Hi,

I’m using a third party JS library which needs a specific cookie to function correctly. Probably a dumb question but is there a way set cookies within Livewire?

Thanks,
Robert

https://laravel.com/docs/7.x/helpers#method-cookie

Thanks, @xxdalexx. I tried that but it didn’t work. I guess that’s because Livewire doesn’t have access to the Laravel request after the mount() method.

I think you would be able to have your cookie function in javascript, have a livewire listener trigger it, and fire the livewire event from your component.

Thanks @xxdalexx, that’s a great idea :slight_smile: I guess I was trying to hard to do everything with Livewire.