Hi to everyone!
I’m new in livewire and I’m writing my first website… as a hobby
My question: is it possible to bind a computed property in a foreach cycle? I think yes but I don’t know how
I have a computed property in my LW component:
public function getReciptProperty()
{
return Recipt::where('user_id',$this->user_id)->paginate(5);
}
In my blade file I have:
@foreach($this->recipt as $rec)
<!-- COMMENTO -->
<textarea wire:model.lazy=" WHAT I HAVE TO WRITE HERE??? "
class="py-1 px-2 my-1 rounded shadow-2xl border"></textarea>
@endforeach
what I want to do: I’m trying to load the comment from db in the textarea and then, when the user modifies the comment, the “updated” method is called. In this method I will update the db. ‘comment’ is the column in the table of db.
I’ve found this solution to workaround but I’m sure this is not the best way.
In the blade file:
and then in LW component
May be it is a stupid question and the solution is simple… if someone wants to give me a reference in the help or a link, it would be highly appreciated!
Laravel 7
Livewire 2.2.3
Thank you!
Marco