Reputation: 65
I can make a Folder Successfully when a user create his account based on his chosen username but I also want to instruct make sub folders for instance when you create an account with username "john" a folder is created called "john" what about if I want to create sub folders for this user.
So basically when your username is "john" I want to create sub folders like :
john/folder1
john/folder2
john/folder3
here is the main folder code line :
File::MakeDirectory('/home/vagrant/Code/laravel/UserFolders/' . $data['username']);
Upvotes: 0
Views: 3289
Reputation: 17545
You can do this by setting recursive option of File::makeDirectory method to true which will create all folders/sub folders in the path if they don't exists:
File::makeDirectory($path=base_path("public/userfolder/{$data['username']}"), $mode = 0755, $recursive = true, $force = false);
Upvotes: 5