Frank Vèssia Posted January 23, 2015 Share Posted January 23, 2015 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... Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 23, 2015 Share Posted January 23, 2015 NotificationArray is extending WireArray, so all the WireArray functions should work there. Link to comment Share on other sites More sharing options...
Frank Vèssia Posted January 23, 2015 Author Share Posted January 23, 2015 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, Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 23, 2015 Share Posted January 23, 2015 Without the slice there's a correct NotificationArray returned? Link to comment Share on other sites More sharing options...
Frank Vèssia Posted January 23, 2015 Author Share Posted January 23, 2015 yes of course...I can display correctly all notifications Link to comment Share on other sites More sharing options...
Frank Vèssia Posted January 25, 2015 Author Share Posted January 25, 2015 Any idea? Maybe they are still in development and some functions don't work? Link to comment Share on other sites More sharing options...
Frank Vèssia Posted January 31, 2015 Author Share Posted January 31, 2015 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"); 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now