which url should be returned instead?
Feb 8, 2020
9
Level 3
Storage symlink or asset() path not working.
Hello,
I have multiple files uploaded per Product in my application. I am using the local storage at this point, but will use s3 in production. When I do the following, it works:
<img id="prod-img" class="min-w-10 border border-red-600"
src="{{ explode("/", $product->images[0]->path)[2] }}" alt="">
<script>
This translates to
vv4S2dQoIJaLPG6K5Pd1cDeDsrdK1zagjZEPCSfl.jpeg
However just calling the regular asset() method does not work:
<img id="prod-img" class="min-w-10 border border-red-600" src="{{ asset($product->images[0]->path) }}"
alt="">
This translates to:
http://dol-store-laravel.test/public/products/vv4S2dQoIJaLPG6K5Pd1cDeDsrdK1zagjZEPCSfl.jpeg
Why is asset() returning an invalid path? I will need a functional fully qualified uri at some point. I also find it strange that the image loads with no relative path, just the image name... laravel magic happening somewhere? I'm new to this framework.
I ran php artisan storage:link.
Thanks.
Please or to participate in this conversation.