@fedaaelmasri can you make it code in format by placing ``` before and after the code so we can understand properly
Mar 9, 2020
4
Level 1
laravel not show new image after editing only if remove cache
When I modify the images, the editing process succeeds, but no changes are made to the pictures and the new image does not appear after the edit except when I delete the cache.
$brands = Brands::findOrfail($id);
$image = $request->file('image');
if ($image && $image->isValid()) {
$path = $image->storeAs('brands', basename($brands->image),'public');
$brands->image = $path;
}
$brands->name = $request->input('name');
$brands->description =$description;
if ($brands->save()) {
return redirect(route('admin.brands'))->with([
'message' => sprintf(' The Brand: "%s" edit success !', $brands->name),
'alert-type' => 'success'
]);
} else {
return redirect()->back()->with([
'message' => sprintf(' The Brand : "%s" can not edit success !', $brands->name),
'alert-type' => 'error'
])->withInput();
}
Please or to participate in this conversation.