Browse Source

Funcionalidad corregida vehiculos editar

main
Damian 4 weeks ago
parent
commit
ebd3a1658e
  1. 12
      app/Http/Controllers/TiposVeiculosController.php
  2. 3
      resources/views/vehiculosCrearEditar.blade.php

12
app/Http/Controllers/TiposVeiculosController.php

@ -69,8 +69,8 @@ class TiposVeiculosController extends Controller
*/
public function edit($id)
{
$tiposVeiculos = tiposVeiculos::find($id);
return view('vehiculosCrearEditar',['tiposVeiculos'=>$tiposVeiculos]);
$tipoVehiculo = tiposVeiculos::find($id);
return view('vehiculosCrearEditar', ['tipoVehiculo' => $tipoVehiculo]);
}
/**
@ -78,10 +78,10 @@ class TiposVeiculosController extends Controller
*/
public function update(Request $request, $id)
{
$tiposVeiculos = tiposVeiculos::find($id);
$tiposVeiculos->fill($request->all());
$tiposVeiculos->save();
return redirect()->route('vehiculos.index');
$tipoVehiculo = tiposVeiculos::find($id);
$tipoVehiculo->fill($request->all());
$tipoVehiculo->save();
return redirect()->route('vehiculos.index')->with('success', 'Vehículo actualizado exitosamente.');
}
/**

3
resources/views/vehiculosCrearEditar.blade.php

@ -69,8 +69,7 @@
class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
Cancelar
</a>
<button type="button"
onclick="confirmarAccion()"
<button type="submit"
class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
{{ isset($tipoVehiculo) ? 'Actualizar' : 'Guardar' }}
</button>

Loading…
Cancel
Save