Level 75
You have to store your path to file, or just name of file into database, it's up to you.
So you can do something like this
$user->update($request->all() + [
'backgroundPicture' => $toske
]);
I hope you get a main idea.
I have this in my controller to store background image
$currentBackgroundPicture = $user->backgroundPicture;
if($request->backgroundPicture != $currentBackgroundPicture){
$toske = time().'.' . explode('/', explode(':', substr($request->backgroundPicture, 0, strpos($request->backgroundPicture, ';')))[1])[1];
Image::make($request->backgroundPicture)->save(public_path('img/profile/').$toske);
$request->merge(['backgroundPicture' => $toske]);
$backPhoto = public_path('img/profile/').$currentBackgroundPicture;
if(file_exists($backPhoto)){
@unlink($backPhoto);
}
}
$user->update($request->all());
If i should put the local store image name inside the database manually and i try to upload another image i get this error
"message": "Unable to init from given binary data.",
"exception": "Intervention\Image\Exception\NotReadableException",
"file": "C:\MAMP\htdocs\Main Api\api\vendor\intervention\image\src\Intervention\Image\Gd\Decoder.php"
it is saving inside public path but it is not storing inside the database table
Please or to participate in this conversation.