Skip to content

Commit

Permalink
Merge branch 'local_disk_url_root' of https://github.com/shadoWalker8…
Browse files Browse the repository at this point in the history
…9/framework into shadoWalker89-local_disk_url_root
  • Loading branch information
taylorotwell committed Nov 7, 2016
2 parents 8c8eb21 + 0e1692e commit 051f3c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/Illuminate/Filesystem/FilesystemAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ public function url($path)

return $adapter->getClient()->getObjectUrl($adapter->getBucket(), $path);
} elseif ($adapter instanceof LocalAdapter) {
$flysystemConfig = $this->driver->getConfig();

if ($flysystemConfig->has('url_root')) {
return $flysystemConfig->get('url_root').'/'.$path;
}

$path = '/storage/'.$path;

return Str::contains($path, '/storage/public') ? Str::replaceFirst('/public', '', $path) : $path;
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Filesystem/FilesystemManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ protected function getRackspaceContainer(Rackspace $client, array $config)
*/
protected function createFlysystem(AdapterInterface $adapter, array $config)
{
$config = Arr::only($config, ['visibility', 'disable_asserts']);
$config = Arr::only($config, ['visibility', 'disable_asserts', 'url_root']);

return new Flysystem($adapter, count($config) > 0 ? $config : null);
}
Expand Down

0 comments on commit 051f3c8

Please sign in to comment.