public function delete(Request $request, $id = 0) { if ($id) { try { Role::destroy($id); \DB::table('role_user')->where('role_id', $id)->delete(); } catch (ModelNotFoundException $e) { return redirect('admin/role', ['errors' => $e]); } } else { return redirect('admin/role', ['errors' => 'ID is missing. ']); } return redirect('admin/role'); }
public function deleteBulk(Request $req, Role $RoleModel) { // if the table_records is empty we redirect to the roles index if (!$req->has('table_records')) { return redirect()->route('roles.index'); } $ids = array_filter($req->input('table_records'), function ($id) { return $id != 1; }); // we delete all the roles with the ids $ids $RoleModel->destroy($ids); // we redirect to the role index view with a success message return redirect()->route('roles.index')->with('success', trans('users::roles.delete_bulk_success')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { Role::destroy($id); Session::flash('message', 'Usuario Eliminado Correctamente'); return Redirect::to('/usuario'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Role::destroy($id); return redirect()->route('role.index'); }