We will focus how to retrieve images or files from storage and it's sub folders in Laravel. Specially we will learn how to retreive or show images or files from storage/app/public/sub_folders.
Let's understand a basic command.
php artisan storage:link
This command you want to use, after creating a folder inside storage folder, whenever you want to retreive files or image that lies in storage or sub folder of storage folder.
Must know
√ / leads to public folder
√ /storage/ leads to /storage/app/public/
The reason behind this is in the root/config/filesystems.php
Here you will see how storage represents app/public folder inside storage folder.
So storage_path refers to storage folder and storage_path('app/public') refer to /storage/app/public/
In your laravel blade it would look like this
echo asset('storage/file.jpg'); //without subfolder uploads
echo asset('storage/uploads/file.jpg');
First file file.jpg is right inside storage/app/public/ folder and second line file.jpg is inside storage/app/public/uploads/
For the first line in browser you may type in www.example.com/storage/file.jpg and
for the second one you will also do the same.
@dbestech