/**
  * Show all notifications
  *
  * @return string
  */
 public function index()
 {
     try {
         //Get the notifications for the currently logged in user
         $notifications = $this->userRepo->paginateNotifications($this->auth->user());
         //Get next Page url
         $nextPageUrl = generate_next_page_url($notifications);
         //This is not an ajax request
         if (!$this->input->is_ajax_request()) {
             //Load view with data
             $this->load->view('pages/notifications', compact('notifications', 'nextPageUrl'));
         } else {
             //Is an ajax request
             echo json_encode(['error' => false, 'grid' => $this->load->view('pages/partials/_notifications-grid', compact('notifications'), true), 'nextPageUrl' => $nextPageUrl]);
         }
     } catch (Exception $e) {
         //This is not an ajax request
         if (!$this->input->is_ajax_request()) {
             //Show error page
             show_404();
         } else {
             //Is an ajax request
             echo json_encode(['error' => true, 'message' => $e->getMessage()]);
         }
     }
 }