Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Livewire says a property type is not supported when you paginate

ErrorProperty type not supported in Livewire error while using paginate() method

Short answer

Livewire public properties only accept a limited set of types, and a paginator or query builder is not one of them. Do not store paginate() in a public property. Return it from a computed property or from render(), and use the WithPagination trait so the page links work.

  • Applies to Livewire 3, Laravel 12, PHP 8.3
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find the public property that receives paginate() and note its assignment. A paginator stored on the component is the usual culprit.

    grep -rn "paginate(" app/Livewire/
  2. 2Match what you see, then jump to its fix

    1. 1The error names the property that is assigned paginate() or a query builderA paginator is stored in a public propertyFix
    2. 2The property holds your own class, DTO or an Eloquent queryA custom class or query is stored on the componentFix
    3. 3A component that paginates but does not use the traitThe WithPagination trait is missingFix

What does the error look like?

  • Property type not supported in Livewire error while using paginate() method
  • Property type not supported in Livewire

Cause 1 of 3

A paginator is stored in a public property

1Check

Livewire supports arrays, strings, integers, floats, booleans, null, and common PHP types such as Collection, Eloquent Collection, Model, DateTime, Carbon, Stringable and BackedEnum. Public properties are turned into JSON and back on each request, so other classes cannot be stored.

grep -rn "public \$" app/Livewire/ | grep -i "post\|users\|items"

2Fix

Remove the public property. Return the paginator from a computed property and read it in the view as $this->posts.

use Livewire\Attributes\Computed;
use Livewire\WithPagination;

class ShowPosts extends Component
{
    use WithPagination;

    #[Computed]
    public function posts()
    {
        return Post::paginate(10);
    }
}

3Verify

Load the component; the error is gone and the list renders.

php artisan view:clear

Confirmed by livewire.laravel.com

Did this fix it?

Cause 2 of 3

A custom class or query is stored on the component

1Check

A custom class is not on the supported list. Livewire's route for custom classes is the Wireable interface, and for Eloquent data it recommends computed properties, because a stored collection re-runs its query when it is hydrated.

grep -rn "implements Wireable" app/

2Fix

Make the class implement Wireable with toLivewire() and fromLivewire(), or keep only simple data in properties and compute the rest.

class Customer implements Wireable
{
    public function toLivewire() { return ['name' => $this->name, 'age' => $this->age]; }
    public static function fromLivewire($value) { return new static($value['name'], $value['age']); }
}

3Verify

The component mounts without the property type error.

php artisan view:clear

Confirmed by livewire.laravel.com

Did this fix it?

Cause 3 of 3

The WithPagination trait is missing

1Check

Each component that paginates must use the Livewire WithPagination trait.

grep -rn "WithPagination" app/Livewire/

2Fix

Add the trait to the component class.

use Livewire\WithPagination;

class ShowPosts extends Component
{
    use WithPagination;
}

3Verify

Click the second page link; the list changes.

php artisan view:clear

Confirmed by livewire.laravel.com

Did this fix it?

How do I stop it coming back?

  • Keep public properties for small, simple state only; load data in computed properties.
  • Remember that every public property is sent to the browser and back on each request.
  • Add WithPagination as soon as a component paginates.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

composer require maatwebsite/excel fails to install

Composer says the package needs an older PHP than the one installed

Composer refuses maatwebsite/excel when the PHP version or a PHP extension does not match what the package and PhpSpreadsheet need.

3 causes, each with a fix

Back end

composer require laravel/horizon fails: ext-pcntl is missing

laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system

Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.