Skip to content

[5.4] Add path method to get the full path of the given file - #20395

Merged
taylorotwell merged 1 commit into
laravel:5.4from
themsaid:fakeStorageUrls
Aug 2, 2017
Merged

[5.4] Add path method to get the full path of the given file#20395
taylorotwell merged 1 commit into
laravel:5.4from
themsaid:fakeStorageUrls

Conversation

@themsaid

@themsaid themsaid commented Aug 2, 2017

Copy link
Copy Markdown
Member

For example:

response()->download(Storage::disk('local')->path('file.txt'));

Currently you could use the url() method:

response()->download(Storage::disk('local')->url('file.txt'));

But when you use Storage::Fake() the return value of url() will be a non-existing file thus response->download() will error.

@miscbits

miscbits commented Aug 2, 2017

Copy link
Copy Markdown
Contributor

Should the method be called realPath instead of path? Looks like its returning the full file path and not a relative one.

@taylorotwell
taylorotwell merged commit 9efaf00 into laravel:5.4 Aug 2, 2017
@decadence

Copy link
Copy Markdown
Contributor

Finally. I don't believe it doesn't exist in 2017 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants