Store value in private property not to be seen in frontend

Hi,

I need to store a value within a private property that mustn’t be seen at the frontend. But, when I am using such private property, the value won’t be stored. I read it in the docs:

protected and private properties DO NOT persist between Livewire updates. In general, you should avoid using them for storing state.

But, I think there is a solution to store and use private properties throughout the whole component. I’m sure there is one I just can’t think of. Because, I am new to livewire. I just need one value to be stored, that mustn’t be seen ANYWHERE at the frontend.

THX

Hi,
You can use session variables and read store, modify what you want without showing in the frontend.
I use it many times with livewire when I don’t want something available on the frontend. hope that helps

@xtreme2020 Thanks very much. Exactly what I needed!

1 Like