i have a problem when updating the database
error: Method Illuminate\Database\Eloquent\Collection::save does not exist.
controller:
public function actualizar(Request $request){
$nuevoIngreso = \App\Models\Servicio::all();
$nuevoIngreso->costo = $request->costo;
$nuevoIngreso->duracion = $request->duracion;
$nuevoIngreso->mantenimiento = $request->mantenimiento;
$nuevoIngreso->save();
return redirect('servicios')->with('mensaje', 'Ficha Actualizada.');
}
blade.php
<form method="POST" action="">
@csrf
@foreach ($servicios as $costo)
<h1 class="text-center text-primary"> </h1>
<div class="form-group row">
<label for="example-text-input" class="col-md-2 col-form-label form-control-label">Costo</label>
<div class="col-md-10">
<input class="form-control" type="text" value="">
</div>
<label for="example-text-input" class="col-md-2 col-form-label form-control-label">Duración</label>
<div class="col-md-10">
<input class="form-control" type="text" value="" id="example-text-input">
</div>
<label for="example-text-input" class="col-md-2 col-form-label form-control-label">Mantenimiento</label>
<div class="col-md-10">
<input class="form-control" type="text" value="" id="example-text-input">
</div>
</div>
<hr>
@endforeach
<button type="submit" class="btn btn-success float-right" float-rightdata-toggle="sweet-alert" data-sweet-alert="success">SAVE</button>
</form>
help please
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2T4aXGq
via IFTTT
Aucun commentaire:
Enregistrer un commentaire