06.10.2016 Views

laravel-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Filesystem / Cloud Storage 363<br />

1 Storage::put('file.jpg', $contents);<br />

2<br />

3 Storage::put('file.jpg', $resource);<br />

The copy method may be used to copy an existing file to a new location on the disk:<br />

1 Storage::copy('old/file1.jpg', 'new/file1.jpg');<br />

The move method may be used to rename or move an existing file to a new location:<br />

1 Storage::move('old/file1.jpg', 'new/file1.jpg');<br />

Prepending / Appending To Files<br />

The prepend and append methods allow you to easily insert content at the beginning or end of a file:<br />

1 Storage::prepend('file.log', 'Prepended Text');<br />

2<br />

3 Storage::append('file.log', 'Appended Text');<br />

File Visibility<br />

File visibility can be retrieved and set via the getVisibility and setVisibility methods. Visibility<br />

is the abstraction of file permissions across multiple platforms:<br />

1 Storage::getVisibility('file.jpg');<br />

2<br />

3 Storage::setVisibility('file.jpg', 'public')<br />

Additionally, you can set the visibility when setting the file via the put method. The valid visibility<br />

values are public and private:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!