try this?
public function render()
{
$this->contacts = Contact::where('is_contacted','!=',$this->pending)
->orderBy('created_at','desc')
->paginate(10)
->items();
return view('livewire.contacts-table');
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Dang it... this is what I get for waiting so long to move away from 6.x and try to play catch up with 8.x.
I am attempting to pass paginated results from a livewire component into my view, but continue to get the following error:
Livewire\Exceptions\PublicPropertyTypeNotAllowedException
Livewire component's [contacts-table] public property [contacts] must be of type: [numeric, string, array, null, or boolean]. Only protected or private properties can be set as other types because JavaScript doesn't need to access them.
My LW component
namespace App\Http\Livewire;
use App\Models\Contact;
use Livewire\Component;
class ContactsTable extends Component
{
public $contacts;
public $pending = true;
public $search;
public function render()
{
$this->contacts = Contact::where('is_contacted','!=',$this->pending)
->orderBy('created_at','desc')
->paginate(10);
return view('livewire.contacts-table');
}
}
And in the livewire blade component...
@forelse($contacts as $contact)
...
@empty
@endforelse
In several video tuts of livewire, I see very similar code (just minus the where and orderBy).
Where am I going wrong? TIA
try this?
public function render()
{
$this->contacts = Contact::where('is_contacted','!=',$this->pending)
->orderBy('created_at','desc')
->paginate(10)
->items();
return view('livewire.contacts-table');
}
Please or to participate in this conversation.