/** * 数据绑定到视图。 * * @param View $view * @return void */ public function compose(View $view) { $category = CategoryRepository::where('model', '=', '2')->get(); $about = DocumentRepository::byIdOrNameMark('about')->first(); $contact = DocumentRepository::byIdOrNameMark('contact')->first(); $config = config('home'); $view->with(['homeconfig' => $config, 'Categories' => $category, 'about' => $about, 'contact' => $contact]); }
/** * 获取所有 * * @return Array */ public function get() { return DocumentRepository::with('article')->with('byMember')->with('category')->where('model_id', '=', 2)->paginate(10); }
/** * 下一篇 * * @return Array */ public function nextGet($id) { $current = DocumentRepository::byMark($id)->first(); $next = $current->where('id', '>', $current['id'])->where('category_id', '=', $current['category_id'])->orderBy('id', 'asc')->first(); if ($next) { return $next; } return false; }