You're browsing the documentation for an old version of Livewire. Consider upgrading your project to Livewire 3.x.
Livewire offers an api for accessing dynamic properties. This is especially helpful for deriving properties from the database or another persistent store like a cache.
1class FooComponent extends Component2{3 // Computed Property4 public function getFooProperty()5 {6 return 'foo';7 }
Now, you can access $this->foo
from either the component's class or Blade view:
1<div>2 <span>{{ $this->foo }}</span>3</div>
Computed properties are cached for an individual Livewire request lifecycle. Meaning, if you call `$this->post` 5 times in a component's blade view, it won't make a separate database query every time.
Next Topic →
Reference