How to get file URL using Storage facade in laravel 5?

前端 未结 13 646
庸人自扰
庸人自扰 2020-11-30 22:40

I\'ve been experimenting using the new Flysystem integration with Laravel 5. I am storing \'localised\' paths to the DB, and getting the Storage facade to complete the path

相关标签:
13条回答
  • 2020-11-30 23:44

    In my case, i made separate method for local files, in this file: src/Illuminate/Filesystem/FilesystemAdapter.php

        /**
     * Get the local path for the given filename.
     * @param $path
     * @return string
     */
    public function localPath($path)
    {
        $adapter = $this->driver->getAdapter();
        if ($adapter instanceof LocalAdapter) {
            return $adapter->getPathPrefix().$path;
        } else {
            throw new RuntimeException('This driver does not support retrieving local path');
        }
    }
    

    then, i create pull request to framework, but it still not merged into main core yet: https://github.com/laravel/framework/pull/13605 May be someone merge this one))

    0 讨论(0)
提交回复
热议问题