public function getEvents($categoryID) { $category = $this->categoryRepository->findById($categoryID); $events = $this->eventRepository->model->where('category_id', $category->id)->paginate(5); $categories = $this->categoryRepository->getEventCategories()->get(); $this->title = $category->name; $this->render('site.category.events', compact('events', 'categories')); }