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) public function edit($id)
{ {
$tiposVeiculos = tiposVeiculos::find($id); $tipoVehiculo = tiposVeiculos::find($id);
return view('vehiculosCrearEditar',['tiposVeiculos'=>$tiposVeiculos]); return view('vehiculosCrearEditar', ['tipoVehiculo' => $tipoVehiculo]);
} }
/** /**
@ -78,10 +78,10 @@ class TiposVeiculosController extends Controller
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
$tiposVeiculos = tiposVeiculos::find($id); $tipoVehiculo = tiposVeiculos::find($id);
$tiposVeiculos->fill($request->all()); $tipoVehiculo->fill($request->all());
$tiposVeiculos->save(); $tipoVehiculo->save();
return redirect()->route('vehiculos.index'); 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"> 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 Cancelar
</a> </a>
<button type="button" <button type="submit"
onclick="confirmarAccion()"
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"> 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' }} {{ isset($tipoVehiculo) ? 'Actualizar' : 'Guardar' }}
</button> </button>

Loading…
Cancel
Save