I am new to laravel and having trouble figuring out the path and creating a sub folder for workorders when the user submits the order in laravel 11. I have a create user folder on registration in storage-> private-> user_files
This is in my registered userController to create folder. Private2 is my config/filesystems.php file
$folderName = $user->id . '_' . $user->name;
$file_folder_path = $folderName;
$userDirectory = $file_folder_path;
Storage::disk('private2')->makeDirectory($userDirectory );
$user->save();
Here is a diagram 1.) New user folder created on registration (works)2.) ->orders folder created on order submit form(sub folder for user folder) for new orders(trying to figure out how to reference the user folder that is created with $user->id . '_' . $user->name;)
Thanks
Tried creating new driver in filesystem. Tried adding {user_id}_{user_name} to 'root' => storage_path('app/private/user_files'),
$file_folder_pathand$userDirectoryhold the exact same value as$folderNameand are redundant. Other than that I think$folderNameneeds a slash before it, so the directory is actually created in yourprivate2disk.