@lansoirthemos the problem could be your public $data.
You setting $data as a variable but no data, what data are you pulling?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i dont seem to find the question that match my case so i'm just gonna make one.
My problem is when i make an index page show all record of the DataBase with checkbox, the moment i click the checkbox, it shows an erorr like this "Attempt to read property "id" on array"
My component is like this:
class ProductCheckbox extends Component { public $data; public $selectedProduct = [];
public function render()
{
return view('livewire.product-checkbox');
}
} And my view is like this:
Name<tbody>
@foreach ($data as $product)
<tr>
<td>
<input type="checkbox" value="{{ $product->id }}" wire:model="selectedProduct">
</td>
<td> {{ $product->name }} </td>
@endforeach
</tbody>
Although https://www.developerbook.net/ when i check $selectedProduct, there is already value in it when i click the checkbox, but it still show the error box "Attempt to read property "id" on array", and it point the error right at the "Please or to participate in this conversation.