I am trying to save fine path in database and save image file in folder but I want to save file with unique name. How to do that?
My controller is :
$image = $request->photo;
//$photoname_path = 'images'.$date.'/'.$image->getClientOriginalName();
$image->move('images',$image->getClientOriginalName());
$photoname = 'images/'.$image->getClientOriginalName();
$adduser = new Employee;
$adduser->name = $request->name;
$adduser->photo = $photoname;
$adduser->email = $request->email;
$adduser->contact_no = $request->contact_no;
$adduser->pan_no = $request->pan_no;
$adduser->department = $request->department;
$adduser->position = $request->position;
$adduser->save();
return redirect()->back();
I was trying to save it with time but I failed. How to do it?