I have created a symbolic link through the command php artisan storage:link
and I store all the files stored by my users there. Every user has a folder with name of the folder as md5($user_id)
. Then, I want to retrieve the files in my blade
file. The problem is: my user can have multiple uploads so I need to get the number of files located in the directory. I searched the question and I found answers linking to this which has the solution that looks like this:
use Illuminate\Support\Facades\Storage;
$files = Storage::files($directory);
$files = Storage::allFiles($directory);
, but the documentation is unclear. The $directory
variable is not known and I don't know the root path of the method. So, what should my $directory
variable contain so that I can include an image that is located in myProject/public/storage/user_uploads/$name_of_the_folder
.
And by the way, I get the
$name_of_the_folder
dynamically and thestorage
folder inpublic
is the symlink I have created with the above command.