I'm trying to build a REST API with Laravel where users need to update their images. In this case the image has been successfully saved in storage, but I want a response in the form of a link that can be accessed by the frontend later. However, the response was not found. Is there a solution to this problem? Here I attach my code
public function update(Request $request,$userId)
{
$user= User::find($userId->id);
// $photoWithExt= $request->file('photo')->getClientOriginalName();
$filename = $user['nip'];
$extension = $request->file('photo')->getClientOriginalExtension();
$fileNameToStore ='/images/users/'.$filename.'.'.$extension;
$path= $request->file('photo')->storeAs('',$fileNameToStore);
$user->update([
'username'=>$request['username'],
'name'=>$request['name'],
'photo'=> $path
]);
return $user;
}
And when I click the link path, the image is 404. I hope someone can help with this problem

php artisan storage:linkcommand?