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(); }
public function __construct() { adminGateKeeper(); $title = getInput("title"); if (!$title) { new SystemMessage("Title cannot be left blank"); forward(); } $category = new Forumcategory(); $category->title = $title; $category->description = getInput("description"); $category->access_id = getInput("access_id"); $category->owner_guid = getLoggedInUserGuid(); $category->save(); new SystemMessage("Your forum category has been created."); forward("forum"); }
public function action_index($slug, $id) { $topics = Forumtopic::getHomePageList($id); if (!$topics) { return Event::first('404'); } $pagination = $topics->links(); $topics = $topics->results; $category = Forumcategory::where_id($id)->first(array('id', 'slug', 'title')); return View::make('forums::category.index', array('category' => $category, 'topics' => $topics, 'pagination' => $pagination)); }
public function action_index() { $categories = Forumcategory::getHomePageList(); return View::make('forums::home.index', array('categories' => $categories)); }