Created
July 12, 2016 21:38
-
-
Save stevenspads/b96c75cd170dae3d40ab689d10e25245 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// how to write content to a file | |
$content = 'File content ...'; | |
Storage::put( 'myfile.txt', $content ); | |
// how to read content from a file | |
$content = Storage::get( 'myfile.txt' ); | |
// how to delete a file | |
Storage::delete( 'myfile.txt' ); | |
// how to append content to a file | |
$append = 'Appending text...'; | |
Storage::append( 'myfile.txt', $append ); | |
// how to prepend content to a file | |
$prepend = 'Prepended text...'; | |
Storage::prepend( 'myfile.txt', $prepend ); | |
// how to create a directory | |
$directory = '/path/to/dir'; | |
Storage::makeDirectory($directory); | |
// how to delete a directory | |
$directory = '/path/to/dir'; | |
Storage::deleteDirectory($directory); | |
// how to copy a file to another location | |
Storage::copy('myfile.txt', 'myfile_copy.txt'); | |
// how to move a file somewhere else | |
Storage::move('old/myfile.txt', 'new/myfile.txt'); | |
// how to check if a file exist | |
$exists = Storage::exists('myfile.txt'); | |
// how to get size of a file | |
$size = Storage::size('myfile.txt'); | |
// how to check when a file was last modified | |
$time = Storage::lastModified('myfile.txt'); | |
// how to get all files in a directory | |
$directory = '/path/to/dir'; | |
$files = Storage::files($directory); | |
// how to get all files & directories in a parent directory | |
$directory = '/path/to/dir'; | |
$files = Storage::allFiles($directory); | |
// how to get all directories in a parent directory | |
$directory = '/path/to/dir'; | |
$directories = Storage::directories($directory); | |
// how to recursively get all directories in a parent directory | |
$directory = '/path/to/dir'; | |
$directories = Storage::allDirectories($directory); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to display the list of directories in the view?