/** * Remove the specified resource from storage. * * @param int $club-id or $club-slug * @param int $role_id * @return Redirect */ public function destroy($slug, $role_id) { $club = getClub($slug); $perm = ClubRole::find($role_id); if ((countAdmin($club) <= 1 || empty($perm)) && $perm->role->name == 'administrator') { return Redirect::route('club-roles', ['club' => $club])->with('error', "You can't delete the last Admin!"); } $perm->delete(); return Redirect::route('club-roles', ['club' => $club])->with('success', "Permission '{$perm->role->name}' are successfully removed from {$perm->nickname}!"); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $club = getClub($id, 'admin::clubs'); ClubPost::where('club_id', $club->id)->delete(); Club::destroy($club->id); return Redirect::route('admin::clubs')->with('success', 'The club has been deleted'); }
function getClubRoles($id, $redirect_to = 'home') { return getClub($id, $redirect_to = 'clubs'); }