public function action_postcreate($catslug, $catid) { $category = Forumcategory::find($catid); if (is_null($category)) { return Event::first('404'); } $rules = array('title' => 'required|min:2', 'content' => 'required|min:30'); $title = trim(Input::get('title')); $content = trim(Input::get('content')); $validator = Validator::make(compact('title', 'content'), $rules); if ($validator->fails()) { return Redirect::back()->with_errors($validator)->with_input(); } $topic = new Forumtopic(); $topic->title = $title; $topic->slug = Str::slug($title); $topic->forumcategory_id = $category->id; $message = new Forummessage(); $message->content = BBCodeParser::parse($content); $message->content_bbcode = $content; $topic->saveWithMessage($message); $topic_id = $topic->id; $topic_slug = $topic->slug; $url = URL::to_action('forums::topic@index', compact('topic_slug', 'topic_id')) . '#message' . $message->id; return Redirect::to($url); }
public function action_remove($id) { $category = Forumcategory::find($id); if ($category) { $category->delete(); } return Redirect::back(); }