Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function boot() |
||
18 | { |
||
19 | if ($this->app->runningInConsole()) { |
||
20 | $this->publishes([ |
||
21 | __DIR__ . '/config/config.php' => config_path('aliyun-oss.php'), |
||
22 | ], 'config'); |
||
23 | } |
||
24 | $this->mergeConfigFrom( |
||
25 | __DIR__.'/config/config.php', |
||
26 | 'filesystems.disks.aliyun' |
||
27 | ); |
||
28 | |||
29 | $this->app->make('filesystem') |
||
30 | ->extend('aliyun', function ($app, array $config) { |
||
31 | $client = $app->get(OssClient::class); |
||
32 | |||
33 | $adapter = new AliyunOssAdapter($client, $config['bucket'],$config['prefix'],$config['options']); |
||
34 | $filesystem = new Filesystem($adapter, new Config(['disable_asserts' => true])); |
||
35 | $filesystem->addPlugin(new PutFile()); |
||
36 | |||
37 | return $filesystem; |
||
38 | }); |
||
39 | } |
||
40 | |||
57 |