Пример #1
0
 public function read()
 {
     // 需要分页
     $paginator = Notice::select('notices.id', 'notices.title', 'notices.created_at')->leftJoin('user_read_notice', function ($join) {
         $join->on('notices.id', '=', 'user_read_notice.notice_id');
     })->where('user_read_notice.user_id', Sentry::getUser()->user_id)->orderBy('created_at', 'desc')->paginate(static::$default_per_page);
     $notices = $paginator->getCollection();
     return View::make('pages.message-center.message.message', ['notices' => $notices, 'paginator' => $paginator]);
 }
Пример #2
0
 public function home()
 {
     $notices = Notice::select('id', 'title')->orderBy('created_at', 'desc')->limit(2)->get();
     if (Sentry::check()) {
         $message_url = '/message-center/message/all';
     } else {
         $message_url = '/message-center/message/home';
     }
     return View::make('pages.login', ['notices' => $notices, 'message_url' => $message_url]);
 }