Advanced Livewire: A better way of working with models

By @samuel · 2021-10-11 21:08

Advanced Livewire: A better way of working with models

  • By @samuel · 2021-10-16 13:43

    See this: https://twitter.com/archtechx/status/1448758312611233794

    Livewire doesn't let you directly change the serverMemo data, since it's verified via that checksum. But you can change anything in data via the JS runtime which pushes the changes using $set.

    If you couldn't modify data on the frontend, then the Alpine integration wouldn't work — @entangle couldn't work, the $wire proxy wouldn't work — and you couldn't use $set() in wire:click handlers.

    This is a common misunderstanding which is why I covered it in the first part of this series. Everything in the component's data can be modified on the frontend — even if it's not used in any wire:click handlers or other things like that.