I have the following folder-structure:
-storage
-app
-orders
-cat1
-cat2
Within either the cat1
or the cat2
folder (depending on user input) I want to create another folder and put a xml file in there.
This is how I tried to create the directory within the cat1
-folder and put the xml file in there:
$uuid = Uuid::uuid4();
$id = $uuid->toString();
$path = '/orders/cat1/'.$id;
Storage::makeDirectory($path, 0755, true, true);
Storage::put($id.'test.xml', $xml);
What happens:
The folder ($id as name) gets created in the right place:
-storage
-app
-orders
-cat1
-123456789
-cat2
But the xml will be stored in another folder here:
-storage
-app
-123456789 // xml gets stored in another
-test.xml // folder within app-folder
-orders
-cat1
-123456789 // where the xml should be placed
-cat2
I just can seem to find a way to put the xml in the directory I've just created ._.
Storage::put
starts from app
folder.
Use this code:
Storage::put($path . '/test.xml', $xml);