Livewire 3 Help

Error: Property type not supported in Livewire for property: [{"current_page":1,"data":[{"id":1,"name":"Alf.....
<?php

namespace App\Livewire;

use App\Models\Product;
use Livewire\Component;
use Livewire\WithPagination;

class ProductList extends Component
{
use WithPagination;
public $products;

public function mount()
{
$this->products = Product::paginate(5);
}

public function render()
{
return view('livewire.product-list');
}
}
<?php

namespace App\Livewire;

use App\Models\Product;
use Livewire\Component;
use Livewire\WithPagination;

class ProductList extends Component
{
use WithPagination;
public $products;

public function mount()
{
$this->products = Product::paginate(5);
}

public function render()
{
return view('livewire.product-list');
}
}
product-list.blade.php
<div>
@foreach ($products as $product)
<div>
{{ $product->name }}
</div>
@endforeach
{{ $products->links() }}
</div>
<div>
@foreach ($products as $product)
<div>
{{ $product->name }}
</div>
@endforeach
{{ $products->links() }}
</div>
1 Reply
Vp
Vp16mo ago
class ProductList extends Component
{
use WithPagination;

public function render()
{
return view('livewire.product-list',[
'products' => Product::paginate(5);
]);
}
}
class ProductList extends Component
{
use WithPagination;

public function render()
{
return view('livewire.product-list',[
'products' => Product::paginate(5);
]);
}
}
Want results from more Discord servers?
Add your server