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 @edalzell · 2021-10-14 04:30

    Why the __ in $this->__user? Is that a Livewire thing?

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

      No, it's just to distinguish the value from properties, in case both a property and a method with that name existed.

      You can create runtime properties in Livewire, and they won't be included in the frontend data.

      That said, the post has a slight issue. The ??= doesn't work since Livewire overrides __get(), so isset($this->__user) ? $this->user : ... should be used.

      I'll be editing the post later today to fix this + mention some additional improvements.