Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

smily's avatar
Level 1

Paginate notifications in a livewire volt component

Hi, I'm trying to paginate notifications in a livewire volt component like this:

$this->notifications = auth()->user()->notifications()->paginate(5);

I get the error message:

Property type not supported in Livewire for property: [{"current_page":1,"data":[{"id":"70572501-fa2a-4f0b-bfd5-8ae54a2f3014","type":"info","notifiable_type":"App\\Models\\User","notifiable_id":219,"data":{"user_id":219,"user_name":"demo","user_email":"[email protected]","notification_title":"Password reset","notification_description":"A request has been made to reset your password."},"read_at":null,"created_at":"2024-11-29T16:16:14.000000Z","updated_at":"2024-11-29T16:16:14.000000Z"}]

It seems that the Illuminate\Notifications\DatabaseNotificationCollection cannot be paginated? (Method Illuminate\Notifications\DatabaseNotificationCollection::links does not exist)

But I don't know how to put it into a form that can be paginated?

Unfortunately, I can't find anything suitable on Google...

Has anyone had any experience with this?

0 likes
1 reply
4khobta's avatar
   public function with(): array
    {
          return [
            'notifications' =>auth()->user()->notifications()->paginate(5)
        ];
    }

Analog of non-volt component i think)

  public function render()
    {
         $notifications = auth()->user()->notifications()->paginate(5);
        return view('livewire.component', compact('notifications'));
    }

Please or to participate in this conversation.