public function getByCategory($slug) { $category = ClassifiedCategory::where('slug', 'like', $slug)->firstOrFail(); $classifieds = Classified::join('classified_categories', 'classified_categories.id', '=', 'classifieds.classified_category_id')->where('slug', 'like', $slug)->where('is_approved', 1)->paginate(20, array('classifieds.*')); return View::make('classifieds.listings', array('classifieds' => $classifieds, 'category' => $category)); }