diff --git a/app/Http/Controllers/CategoriasController.php b/app/Http/Controllers/CategoriasController.php index e0a2c86..dab4c73 100644 --- a/app/Http/Controllers/CategoriasController.php +++ b/app/Http/Controllers/CategoriasController.php @@ -54,6 +54,22 @@ class CategoriasController extends Controller 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'); + } + /* diff --git a/resources/views/categorias/index.blade.php b/resources/views/categorias/index.blade.php index 7c8f39d..855fd97 100644 --- a/resources/views/categorias/index.blade.php +++ b/resources/views/categorias/index.blade.php @@ -16,7 +16,8 @@ | Ver Más - + | + Editar