I am currently working with laravel and want to update 'Model' with a controller
public function update(Request $request, $id)
{
$request->validate([
'criminal' => 'required|string',
'crimes' => 'required|string',
'happened_at' => 'required',
'description' => 'required|string',
'report' => 'string|nullable',
'happened_at' => 'required',
'testifies' => 'string|nullable',
'officers' => 'string|nullable',
]);
$case = Cases::find($id);
$case->criminal = $request->input('criminal');
$case->crimes = $request->input('crimes');
$case->officers = $request->input('officers');
$case->testifies = $request->input('testifies');
$case->report = $request->input('report');
$case->happened_at = $request->input('happened_at');
$case->crime_desc = $request->input('description');
$case->save();
return redirect('cases.index');
}
It does not save the data and throws an exception:Unexpected data found. Unexpected data found. Data missing
Does somebody know why it throws an exception? Thank you in advance
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire