agregado de función delete
This commit is contained in:
parent
6a5ac55b2e
commit
c874d8d89a
|
|
@ -32,6 +32,12 @@ class CategoriasController extends Controller
|
|||
return view('categorias.show', ["cat"=>$categoria]);
|
||||
}
|
||||
|
||||
public function destroy(Request $request, $id){
|
||||
$categorias = Categorias::findOrfail($id);
|
||||
$categorias->delete();
|
||||
return redirect('/categorias');
|
||||
}
|
||||
|
||||
/*
|
||||
public function create(){
|
||||
return view('categorias.new');
|
||||
|
|
@ -72,11 +78,7 @@ class CategoriasController extends Controller
|
|||
return redirect('/categorias');
|
||||
}
|
||||
|
||||
public function destroy(Request $request, $id){
|
||||
$categorias = Categorias::findOrfail($id);
|
||||
$categorias->delete();
|
||||
return redirect('/categorias');
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,20 +17,20 @@
|
|||
|
||||
<a href="{{ route('categorias.show', $cat->id_categoria) }}">Ver Más</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{{--<a href="{{ route('categorias.edit', $cat->id_categoria) }}">Editar</a>
|
||||
<form action="{{ route('categorias.destroy', $cat->id_categoria) }}"
|
||||
<form action="{{ route('categorias.destroy', $cat->id_categoria) }}"
|
||||
method="POST" >
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button onclick="return confirm('¿Eliminar esta categoría?')">
|
||||
Eliminar
|
||||
</button>
|
||||
</form>--}}
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
{{--<a href="{{ route('categorias.edit', $cat->id_categoria) }}">Editar</a>
|
||||
--}}
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ Route::get('/', function () {
|
|||
|
||||
Route::get('categorias', [CategoriasController::class, 'index'])->name('categorias.index');
|
||||
Route::get('categorias/{categoria}', [CategoriasController::class, 'show'])->name('categorias.show');
|
||||
|
||||
Route::delete('categorias/{categoria}', [CategoriasController::class, 'destroy'])->name('categorias.destroy');
|
||||
|
||||
|
||||
|
||||
|
|
@ -29,4 +29,4 @@ Route::post('categorias', [CategoriasController::class, 'store'])->name('c
|
|||
Route::get('categorias/{categoria}', [CategoriasController::class, 'show'])->name('categorias.show');
|
||||
Route::get('categorias/{categoria}/edit', [CategoriasController::class, 'edit'])->name('categorias.edit');
|
||||
Route::match(['put','patch'], 'categorias/{categoria}', [CategoriasController::class, 'update'])->name('categorias.update');
|
||||
Route::delete('categorias/{categoria}', [CategoriasController::class, 'destroy'])->name('categorias.destroy');*/
|
||||
*/
|
||||
Loading…
Reference in New Issue
Block a user