@denis
To create a directory in Laravel, you can use the Storage
facade provided by Laravel. The Storage
facade provides a simple way to interact with the filesystem in Laravel.
Here's how you can create a directory using the Storage
facade:
1
|
use IlluminateSupportFacadesStorage; |
1
|
Storage::makeDirectory('path/to/new/directory'); |
Replace 'path/to/new/directory'
with the path where you want to create the new directory. Laravel will create the directory for you if it does not already exist.
You can also pass a second argument to the makeDirectory
method to specify the visibility of the directory (e.g., 'public' for public visibility). Here's an example:
1
|
Storage::makeDirectory('path/to/new/directory', 0777, true); |
This will create a public directory with read, write, and execute permissions for everyone.