Reputation: 75
I am trying to make a directory inside a directory using the following code:
Storage::makeDirectory('app/public' . $data['code'] . '/' . 'themes', true);
So the structure will be :
Folder 1 : app/public/123
Folder 2: app/public/123/themes
I have been trying for the last 2 hours. I hope somebody can help. Thanks !
Upvotes: 2
Views: 3920
Reputation: 714
In your app check what the path given in config/filesystem.php
on line 44. So when you trying to create directory
or a file
check the storage directory
Upvotes: 0
Reputation: 75
The problem was the path structure.
The following code worked :
Storage::makeDirectory('public/' . $data['code'] . '/' . 'themes');
Upvotes: 1
Reputation: 6004
You can create the directories recursively by calling makeDirectory() method
over
File` object
$result = File::makeDirectory('/path/to/directory', 0775, true);
In Your case, To create the themes
directory inside storage
directory
Storage::makeDirectory('themes', 0775, true);
To create a file inside the public directory
$result=File::makeDirectory('app/public/' . $data['code'] . '/' . 'themes',0755, true);
dd($result);
Upvotes: 1