buildTemporaryUrlsUsing does not exist on laravel storage facade

Viewed 320

I'm using local storage and s3 so would like to use temporary urls, I know I can't use them on the local disk so found on the docs that you can override that function for the local disk in the AppServiceProvider, I am on laravel 8.22 however am getting a error shown below:

Call to undefined method League\Flysystem\Filesystem::buildTemporaryUrlsUsing

The code I'm attempting to use:

Storage::disk('local')->buildTemporaryUrlsUsing(function ($path, $expiration, $options) {
    return URL::temporarySignedRoute(
        'files.download',
        $expiration,
        array_merge($options, ['path' => $path])
    );
});

https://laravel.com/docs/8.x/filesystem#temporary-urls

1 Answers

You have to use

use Illuminate\Support\Facades\Storage;

in your AppServiceProvider

Related