Reputation: 246
I want to save the uploads from the users in a path with the user ID. How can I integrate the ID into the path that automatically creates the folder?
if($r->hasFile('avatar'))
{
Auth::user()->update([
'avatar'=> $r->avatar->store('public/$id/avatar')
]);
}
Upvotes: 0
Views: 37
Reputation: 3113
You need double quotes if you want your id variable to be interpolated there:
'avatar'=> $r->avatar->store("public/$id/avatar")
Upvotes: 2