public function destroy($id) { if (Auth::user()->getRol() == "Institución" && Auth::user()->extractRolName($id) == "Administrador") { Session::flash('message', 'No posee privilegios para eliminar esta entidad'); return redirect()->route('entidades.index'); } if (Auth::user()->getRol() == "Institución" && Auth::user()->checkRol($id) == "Institución") { if (Auth::user()->getNameEntity() != Auth::user()->nameEntity($id)) { Session::flash('message', 'No posee privilegios para editar esta entidad'); return redirect()->route('entidades.index'); } } $entity = Entity::findOrFail($id); $entity->delete($id); Session::flash('message', $entity->name . ' ' . 'fue eliminado de nuestros registros.'); return redirect()->route('entidades.index'); }
public function destroy($id) { try { $n = Entity::findOrFail($id); $n->delete(); Session::flash('message_type', 'success'); Session::flash('message', 'Elemento rimosso correttamente. <a class="undo-button" href="/entity/' . $id . '">Undo</a>'); } catch (\Exception $e) { Session::flash('message_type', 'danger'); Session::flash('message', 'Elemento non rimosso correttamente.'); } return ""; }
/** * Remove the specified entity from storage. * * @param int $id * @return Response */ public function destroy($id) { $entity = Entity::findOrFail($id); $entity->delete(); return redirect()->route('entities.index')->with('message', 'Item deleted successfully.'); }