I use the below store function in my controller. And the image im uploading is getting stored in the public/images/ folder. How can i display that image in view? Pls help me.
public function store(Request $request) {
$this - > validate($request, [
'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
]);
$imageName = time().'.'.$request - > image - > getClientOriginalExtension();
$request - > image - > move(public_path('images'), $imageName);
$stock = Stock::create([
'tag_no' => $request - > input('tag_no'),
'image' => $imageName,
'user_id' => Auth::user() - > id
]);
if ($stock) {
return redirect()->route('stocks.index', ['stocks' => $stock - > tag_no])->with('success', 'Stock created successfully');
}
}
return back() - > withInput() - > with('errors', 'Error creating new Stock');
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire