I have a simple crud application using Laravel 8
. My saving code is perfectly working. But my update code is not working. My console is not returning any error. Did I miss something that causes it not to save?.
Code
private $validations;
public function __constructor()
{
$this->validations([
'name' => 'required',
'email' => "required|email",
'phone' => "required",
'dob' => "required|date",
'interested_package' => 'sometimes'
]);
}
public function update(Request $request)
{
$rules = $this->validations;
$rules['id'] = 'required|exists:leads';
$postData = $this->validate($request, $rules);
Lead::where('id', $postData['id'])->update($postData);
return redirect()->route('lead.view', ['lead' => $postData['id']]);
}
Update
Here is my Table structure
question from:
https://stackoverflow.com/questions/65912717/update-method-not-saving 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…