I wanted to know how do I avoid file collision in Laravel. Lets say I have two users with the same filename and both gets affected because one of them changed the file how do I go about avoiding that. Here is my code
$file = $request->file('file');
$myfilename = $vid->getClientOriginalName().uniqid();
$mypath = $file->storeAs(
'video',
$myfilename);
$location = public_path('/allvids',$myfilename);
$file->move($location);
$file->profile = $myfilename;