本文整理匯總了PHP中App\Repositories\UserRepository::paginateNotifications方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserRepository::paginateNotifications方法的具體用法?PHP UserRepository::paginateNotifications怎麽用?PHP UserRepository::paginateNotifications使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類App\Repositories\UserRepository
的用法示例。
在下文中一共展示了UserRepository::paginateNotifications方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
/**
* 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()]);
}
}
}