binggle's avatar

'database' notification paginate ?

I am struggling with 'notifications' .

I want to use notification pagination in livewire component.

class RightMenu extends Component
{
    use WithPagination;
    public function render()
    {
        $notifications = Auth::user()->notifications->paginate();
    }
}

It cause error .

	livewire Illuminate\Notifications\DatabaseNotificationCollection::paginate does not exist.

I can not find any references on document.

How can I paginate database notification collection?

0 likes
4 replies
chaudigv's avatar

Have you tried passing a value? ->paginate(10)

binggle's avatar

Sorry.

it should be this


$notifications = Auth::user()->notifications()->paginate();
BRVK's avatar

$notifications = Auth::user()->notifications()->paginate(10);

// We should mention the no.of paginate values

binggle's avatar

Hi.. It is wondering..

I coded without perPage. and it works well.

Maybe it is cause withPagination trait.

Please or to participate in this conversation.