I am currently having problems with Laravel 4. I would like to use bullets for forum categories and forum topics (unique bullets). To determine if a user is in a category or topic, I have this route:
Route::get('forum/{slug}', function($slug) {
$category = ForumCategory::where('slug', '=', $slug)->first();
if (!is_null($category))
return Redirect::action('ForumCategoryController@findBySlug', array('slug' => $slug));
else {
$topic = ForumTopic::where('slug', '=', $slug)->first();
if (!is_null($topic))
return Redirect::action('ForumTopicController@findBySlug', array('slug' => $slug));
else
return 'fail';
}
});
And I get the following error when I try to reach a category:
Route [ForumCategoryController@findBySlug] not defined.
Here is my ForumCategoryController:
class ForumCategoryController extends BaseController {
public function findBySlug($slug) {
$category = ForumCategory::where('slug', '=', $slug)->first();
return View::make('forum.category', array(
'title' => 'CatΓ©gorie',
'category' => $category
));
}
}
Where is the problem? Is there any way to make this better? Help me please:)
source
share