mwtodos para editar
This commit is contained in:
parent
b4bf336fe1
commit
44265fe11e
|
|
@ -54,6 +54,22 @@ class CategoriasController extends Controller
|
||||||
return redirect('/categorias');
|
return redirect('/categorias');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function edit($id){
|
||||||
|
$categoria = Categorias::findOrfail($id);
|
||||||
|
//$categoria = Categorias::where('id_categoria',$id)->first();
|
||||||
|
return view('categorias.edit', ["cat"=>$categoria]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id){
|
||||||
|
$categorias = Categorias::findOrfail($id);
|
||||||
|
$categorias->fill([
|
||||||
|
'nombre' => $request->input('nombre'),
|
||||||
|
'descripcion' => $request->input('descripcion'),
|
||||||
|
]);
|
||||||
|
$categorias->update();
|
||||||
|
return redirect('/categorias');
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@
|
||||||
|
|
|
|
||||||
|
|
||||||
<a href="{{ route('categorias.show', $cat->id_categoria) }}">Ver Más</a>
|
<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" >
|
method="POST" >
|
||||||
@csrf
|
@csrf
|
||||||
|
|
|
||||||
|
|
@ -22,5 +22,5 @@ Route::post('categorias', [CategoriasController::class, 'store'])->name('categor
|
||||||
Route::get('categorias/create', [CategoriasController::class, 'create'])->name('categorias.create');
|
Route::get('categorias/create', [CategoriasController::class, 'create'])->name('categorias.create');
|
||||||
Route::get('categorias/{categoria}', [CategoriasController::class, 'show'])->name('categorias.show');
|
Route::get('categorias/{categoria}', [CategoriasController::class, 'show'])->name('categorias.show');
|
||||||
Route::delete('categorias/{categoria}', [CategoriasController::class, 'destroy'])->name('categorias.destroy');
|
Route::delete('categorias/{categoria}', [CategoriasController::class, 'destroy'])->name('categorias.destroy');
|
||||||
|
Route::get('categorias/edit/{categoria}', [CategoriasController::class, 'edit'])->name('categorias.edit');
|
||||||
|
Route::put('categorias/update/{categoria}', [CategoriasController::class, 'update'])->name('categorias.update');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user