"No query results for model [App\WorkExperience\WorkExperience] {id}"

Posted 4 months ago by adswatantra

*Here is my controller

public function updateWorkExperience($id) { $this->validate(request(), [ 'companyName' => 'required|min:5', 'companyAddress' => 'required|min:5', 'jobDetails' => 'required|min:10', ]);

    $workExperiences = WorkExperience::findOrfail($id);

    $workExperiences->companyName = request('companyName');
    $workExperiences->companyAddress = request('companyaddress');
    $workExperiences->position = request('position');
    $workExperiences->jobDetails = request('jobDetails');
    $workExperiences->jobDetails = request('jobDetails');
    $workExperiences->joinDate = request('joinDate');

    return($workExperiences);exit();

    $workExperiences->save();
}
  • script

$(document).off('click' , '#updateWorkExperienceButton'); $(document).on('click' , '#updateWorkExperienceButton' , function(e){ // alert("all good");close(); event.preventDefault(); $.ajax({ type: 'POST', url: "/workexperiences/{id}", data: $('#updateworkExperienceForm').serialize(), success: function (jsons) { if (success) { alert(success); location.reload(); } else { alert(jsons.userUpdatemsg); // $("#usersUpdateerrormsg").show(); // $('#usersUpdateerrormsg').html(json.msg); return false; } } });

});

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.