When I am trying to update the file then getting error like "Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP)" kn laravel
public function update(Request $request, $id) {
$this->validate($request,[
'name'=>'required',
'designation'=>'required',
'contact_ph'=>'required',
'contact_email'=>'required',
'featured'=>'mimes:jpeg,pdf,docx,png:5000',
]);
$staff=Staff::find($id);
if($request->hasFile('featured'))
{
$featured=$request->featured;
$featured_new_name =time() .$featured->getClientOriginalName();
$featured->move('uploads/srcpost', $featured_new_name);
$staff->featured='uploads/srcposts/'. $featured_new_name;
}
$staff->name=$request=name;
$staff->designation=$request=designation;
$staff->ordering=$request=ordering;
$staff->save();
return redirect()->back();
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire