Jump to content

Recommended Posts

Posted

Is there a way to limit/sort/paginate the new notifications system?
I'm using notifications in front end like so

<?php foreach($user->notifications as $no) {
 
} ?>

I tried ->slice with no effect...

Posted

I tried to use ->slice assuming notifications were WireArray but I get error

$notifications = $user->notifications->slice($start,$limit);
Catchable fatal error: Argument 1 passed to NotificationArray::__construct() must be an instance of Page, none given,
Posted

I finally solved using ->filter instead of ->slice like so

$limit = 10;
$start = ( $input->pageNum - 1 ) * $limit;
$notys = $user->notifications->filter("start=$start,limit=$limit,sort=-created");
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...