Laravel 5 - How to access image uploaded in storage within View?

前端 未结 12 2658
悲哀的现实
悲哀的现实 2020-11-22 14:05

I have got user\'s avatars uploaded in Laravel storage. How can I access them and render them in a view?

The server is pointing all requests to /public,

12条回答
  •  [愿得一人]
    2020-11-22 14:22

    without site name

    {{Storage::url($photoLink)}}
    

    if you want to add site name to it example to append on api JSON felids

     public function getPhotoFullLinkAttribute()
    {
        return env('APP_URL', false).Storage::url($this->attributes['avatar']) ;
    }
    

提交回复
热议问题