I’m trying to list all directories in this path public_path().'/assets/fe/img/portfolio'
dd(Storage::directories(public_path().'/assets/fe/img/portfolio'));
I kept getting [], I suppose to get 5.
Why ?
Advertisement
Answer
Storage::directories() try to find directories in storage/app/public folder, certainly because you have asked it to do so in your filesystems.php file.
add this in disks array in filesystems.php file
'public' => [
'driver' => 'local',
'root' => public_path(),
],
then you can use this syntax to get desired output
IlluminateSupportFacadesStorage::disk("public")->directories("assets/fe/img/portfolio")
assuming your public folder is in root directory and has following directory structure

