Example #1
0
 private function getUserData()
 {
     $notifications = Notification::with(['user' => function ($q) {
         $q->select('avatar');
     }])->target(auth()->id())->orderBy('created_at', 'desc')->take(15)->get();
     $data = array_merge(user()->toArray(), ['subscribed_groups' => user()->subscribedGroups(), 'blocked_groups' => user()->blockedGroups(), 'moderated_groups' => user()->moderatedGroups(), 'folders' => user()->folders(), 'notifications' => $notifications]);
     return ['user' => $data];
 }
 public function listNotifications()
 {
     $notifications = Notification::with('user')->target(['user_id' => Auth::id()])->orderBy('created_at', 'desc')->paginate(50);
     return $notifications;
 }