/** * Find a post by it's slug. * * @param $post * @return null|PostInterface */ public function findBySlug($slug) { return $this->model->orderBy('created_at', 'DESC')->where('slug', $slug)->first(); }
/** * Find many posts by category. * * @param CategoryInterface $category * @param null $limit * @return EntryCollection */ public function findManyByCategory(CategoryInterface $category, $limit = null) { return $this->model->orderBy('created_at', 'DESC')->where('category_id', $category->getId())->paginate($limit); }