public function create($parent_slug) { $board = Board::whereSlug($parent_slug)->firstOrFail(); if (Gate::denies('laraboard::thread-create', $board)) { abort(403); } return view('laraboard::thread.create', compact('board')); }
/** * Handles moving the board up or down in the category. * * @param mixed $slug * @param mixed $direction * @return {\Illuminate\Http\RedirectResponse|\Illuminate\Http\RedirectResponse} */ public function reposition($slug, $direction) { $this->authorize('laraboard::category-manage'); $board = Board::whereSlug($slug)->firstOrFail(); // move up if ($direction == 'up') { $board->moveLeft(); } else { $board->moveRight(); } return redirect()->back()->with('success', 'Board successfully moved.'); }