本文整理汇总了PHP中Storage::extend方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::extend方法的具体用法?PHP Storage::extend怎么用?PHP Storage::extend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Storage
的用法示例。
在下文中一共展示了Storage::extend方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
public function boot()
{
\Storage::extend('qiniu', function ($app, $config) {
if (isset($config['domains'])) {
$domains = $config['domains'];
} else {
$domains = ['default' => $config['domain'], 'https' => null, 'custom' => null];
}
$qiniu_adapter = new QiniuAdapter($config['access_key'], $config['secret_key'], $config['bucket'], $domains, $config['notify_url'] ? $config['notify_url'] : null);
$file_system = new Filesystem($qiniu_adapter);
$file_system->addPlugin(new PrivateDownloadUrl());
$file_system->addPlugin(new DownloadUrl());
$file_system->addPlugin(new ImageInfo());
$file_system->addPlugin(new ImageExif());
$file_system->addPlugin(new ImagePreviewUrl());
$file_system->addPlugin(new PersistentFop());
$file_system->addPlugin(new PersistentStatus());
$file_system->addPlugin(new UploadToken());
$file_system->addPlugin(new PrivateImagePreviewUrl());
$file_system->addPlugin(new VerifyCallback());
$file_system->addPlugin(new Fetch());
$file_system->addPlugin(new Qetag());
return $file_system;
});
}
示例2: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
parent::register();
$this->app->make('config')->set('filesystems.disks.media', ['driver' => 'media']);
\Storage::extend('media', function (Application $app, $config) {
return new Media();
});
}
示例3: boot
public function boot()
{
\Storage::extend('ucloud-ufile', function ($app, $config) {
$ufileAdapter = new UcloudUfileAdapter($config['bucket'], $config['public_key'], $config['secret_key'], $config['suffix'], $config['prefix']);
$fs = new Filesystem($ufileAdapter);
return $fs;
});
}
示例4: mockStorage
protected function mockStorage()
{
Storage::extend('mock', function () {
return \Mockery::mock(\Illuminate\Contracts\Filesystem\Filesystem::class);
});
Config::set('filesystems.disks.mock', ['driver' => 'mock']);
Config::set('filesystems.default', 'mock');
return Storage::disk();
}
示例5: boot
public function boot()
{
\Storage::extend('qiniu', function ($app, $config) {
$qiniu_adapter = new QiniuAdapter($config['access_key'], $config['secret_key'], $config['bucket'], $config['domain']);
$file_system = new Filesystem($qiniu_adapter);
$file_system->addPlugin(new PrivateDownloadUrl());
$file_system->addPlugin(new DownloadUrl());
$file_system->addPlugin(new ImageInfo());
$file_system->addPlugin(new ImageExif());
$file_system->addPlugin(new ImagePreviewUrl());
$file_system->addPlugin(new PersistentFop());
$file_system->addPlugin(new PersistentStatus());
$file_system->addPlugin(new UploadToken());
return $file_system;
});
}
示例6: boot
public function boot()
{
class_alias('Illuminate\\Support\\Facades\\Storage', 'Storage');
//for Lumen5.2
\Storage::extend('qiniu', function ($app, $config) {
$qiniu_adapter = new QiniuAdapter($config['access_key'], $config['secret_key'], $config['bucket'], $config['domain'], $config['pipeline'], $config['notify_url']);
$file_system = new Filesystem($qiniu_adapter);
$file_system->addPlugin(new PrivateDownloadUrl());
$file_system->addPlugin(new DownloadUrl());
$file_system->addPlugin(new ImageInfo());
$file_system->addPlugin(new ImageExif());
$file_system->addPlugin(new ImagePreviewUrl());
$file_system->addPlugin(new PersistentFop());
$file_system->addPlugin(new PersistentStatus());
$file_system->addPlugin(new UploadToken());
$file_system->addPlugin(new PutFile());
$file_system->addPlugin(new Put());
return $file_system;
});
}