You see, in the code my user bar I have added this:
@if(auth()->user())
<img class="card-img-top" style="width: 50px; height: 50px;" src="{{auth()->user()->ruta()}}"/>
@endif
The route function refers to this code in User.php:
public function ruta(){
return "storage/".$this->foto;
}
Thanks to this, when a user connects, his picture appears.
However, in certain links the image fails.
It seems that being a url something more complex causes error. In fact, I can fix it with this change in the route method:
public function ruta(){
return "/bolsa/public/storage/".$this->foto;
}
However it is a good billet, so I would like to know how to put the route relative.
Also, being on that problematic route I see myself with another hurry. Among the icons I have another called "change image".
But if I do it from the complex url, I see myself with this.
Provisionally fix it by adding the url function in the href:
<a class="nav-link" href="{{ url('/cambiar_foto') }}">Cambiar imagen</a>
Although it will now have its fabric put "url" at each view. Is there a simpler way?