Livewire 3 Help
Error:
product-list.blade.php
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');
}
}
<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
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);
]);
}
}