In one of the tables that you create from the database there is a field of type file.
The file (image) is stored correctly in the database. As follows:
if($request->file('imagen')){ //condicion de si existe la peticion
$publicacion->imagen=Storage::disk('public')->put('image',$request->file('imagen'));
$publicacion->fill(['file'=>asset($publicacion->imagen)])->save(); //almacena la imagen la carpeta public en una carpeta nueva llamada image.
}
Function in the controller to call the data of the database and show in a view: public function article ($ id) {
$publicaciones=Publicacione::where('id',$id)->get();
return view('articulo')->with('publicaciones',$publicaciones); //la vista se llama articulo y la ruta articulos.
}
View:
<img src="{{$publicacione->imagen}}" alt="">
The image is not displayed, when inspecting the source code the image path is displayed:
image / 7kReFxMpxgucU3Vac5hVqCqdUFRcgtMcQ7sJ3v3T.png but when you click, the following route opens:
PS: The problem I think is generated is by the prefix article of the route, but I do not know how to proceed.