/** * Remove the specified resource from storage. * * @param int $id * * @return mixed */ public function destroy($id) { $canBeDeleted = empty(Role::find($id)->available_appointment->toArray()); if ($canBeDeleted) { Role::destroy($id); \Flash::success('Role deleted!'); } else { \Flash::error('Cannot delete because they are existing appointments for this role.'); } return redirect('admin/data-management/roles'); }
public function getDelete($id) { Role::destroy($id); return redirect()->back(); }
/** * Locate role, detach from perms and users then delete. * * @param $name */ protected static function destroyRole($name) { $roleActiveDirectoryInspector = Role::where('name', $name)->first(); if ($roleActiveDirectoryInspector) { $roleActiveDirectoryInspector->perms()->detach(); $roleActiveDirectoryInspector->users()->detach(); Role::destroy($roleActiveDirectoryInspector->id); } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { if ($result = check_auth_to('JSLB_DELETE')) { return $result; } try { Role::destroy($id); return redirect()->action('Admin\\RoleController@index')->with('operationstatus', 'sucess'); } catch (\Exception $e) { return redirect()->back()->withErrors(['error' => '删除角色失败,请重试(' . $e->getMessage() . ')']); } }
/** * Elimina un rol especifico * * @param int $id * @return Response */ public function delete($id) { $data["id"] = $id; $validator = Validator::make($data, ['id' => 'integer']); if ($validator->fails()) { return response()->json(["msg" => "alert", "validator" => $validator->messages()], 200); } if ($role = Role::destroy($id)) { return response()->json(["msg" => "Success"], 200); } else { return response()->json(["msg" => "error", "description" => "No se ha encontrado el rol"], 200); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Role::destroy($id); $code = 200; $msg = json_encode(array('msg' => $code)); return $msg; }
public function destroyRole($id) { $result = Role::destroy($id); return $result; }