Ich habe eine CRUD
mit einfachem Datum. Aber ich kann die Update-Methode nicht funktionieren.Laravel bearbeiten und aktualisieren funktioniert nicht
Dies ist mein Controller
public function show(Customer $customer)
{
return view('customer.show',compact('customer'));
}
public function edit(Customer $customer)
{
return view('customer.edit', compact('customer'));
}
public function update(CustomerRequest $request, Customer
$customer,$id)
{
$customer = Customer::find($id)->update($request->all());
return redirect()->route('customer.index',compact('customer'));
}
und das ist meiner Meinung nach
<form method="POST" action="{{route('customer.update',$customer->id) }}">
{{--{{dd($customer)}}--}}
{{method_field('PUT')}}
{{ csrf_field() }}
<div class="form-group">
<label for="firstName">Voornaam</label>
<input type="text" class="form-control" name="firstName" value="{{$customer->firstName}}">
</div>
<div class="form-group">
<label for="lastName">Achternaam</label>
<input type="text" class="form-control" name="lastName" value="{{$customer->lastName}}">
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" name="email" value="{{$customer->email}}">
</div>
<div class="form-group">
<label for="phone">Telefoonnummer</label>
<input type="text" class="form-control" name="phone" value="{{$customer->phone}}">
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">Update</button>
</div>
</form>
ich auf der Bearbeitungsseite gehen. Aber, nach dem Ändern der Daten nichts ändern es aussehen wie ich vermisse irgendwo, aber ich weiß es nicht, jetzt bekomme ich, dass dieser Fehler too few arguments to function New Controller ::update() 2 passed and exactly 3 expected.
jede Hilfe wird geschätzt.
vielen Dank, ich ändere tatsächlich das Update auf. Öffentliche Funktion Update (CustomerRequest $ Anfrage, $ ID) {$ Kunde = Kunde :: finden ($ ID) -> update ($ Anfrage-> alle()); return redirect() -> route ('customer.index', compact ('customer')); } und jetzt funktioniert es nur fijn –