本文整理汇总了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()]);
}
}
}