/** * Start a new discussion and fire off the relevant events. * * @param StartDiscussionCommand $command */ public function handle(StartDiscussionCommand $command) { $discussion = $this->factory->start($command->category, Auth::user()->id, $command->title, $command->body); $this->discussions->save($discussion); $this->dispatch($discussion->releaseEvents()); return $discussion; }
/** * @param $categorySlug * @param $discussionSlug * @return \Illuminate\Http\RedirectResponse */ public function destroy($discussionSlug) { $slug = \Input::get('category'); $discussion = $this->discussions->getBySlug($discussionSlug); $this->discussions->delete($discussion); return redirect()->route('category.index', [$slug]); }
/** * Retrieves a list of the most recently updated discussions. * * @return mixed */ public function index() { $discussions = $this->discussions->getRecent(); $categoryCount = $this->categories->count(); return $this->respond('home.index', compact('discussions', 'categoryCount')); }