public function getForums() { $this->layout->title = "Forums"; $this->layout->description = ""; $this->layout->keywords = ""; $this->layout->top_active = 6; $topics = DB::table('topics')->get(); $topics_count = count($topics); $categories = DB::table('categories')->get(); $categories_count = count($categories); $category_topics = Topic::select(DB::raw('count("*") as count, category_id, title,categories.category_name'))->groupBy("category_name")->groupBy("title")->join('categories', 'topics.category_id', '=', 'categories.id')->get(); $this->layout->main = View::make('admin.forums', ['cat_topic' => $category_topics, 'count_cat' => $categories_count, 'count' => $topics_count, "main_tab" => 2, "sub_tab" => 1, "cat" => "forum"]); }
public static function scopeExcellentEx($limit) { return Topic::select('id', 'title', 'user_id', 'created_at')->where('is_excellent', '=', true)->take($limit)->remember(10)->get(); }