Skip to content

Commit df50e8a

Browse files
committed
implement filesystem adapter
1 parent 76fa667 commit df50e8a

File tree

9 files changed

+253
-81
lines changed

9 files changed

+253
-81
lines changed

composer.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@
2424
"php": "^8.2",
2525
"ext-json": "*",
2626
"illuminate/support": "^11.0",
27-
"cloudinary/cloudinary_php": "^2.0"
27+
"cloudinary/cloudinary_php": "^3.0",
28+
"league/flysystem": "^3.29"
2829
},
2930
"require-dev": {
30-
"mockery/mockery": "^1.1",
31-
"orchestra/testbench": "^9.0",
32-
"pestphp/pest": "^2.35",
33-
"sempro/phpunit-pretty-print": "^1.0",
31+
"mockery/mockery": "^1.6",
32+
"orchestra/testbench": "^9.9",
33+
"pestphp/pest": "^2.36",
34+
"sempro/phpunit-pretty-print": "^1.2",
3435
"laravel/pint": "^1.20"
3536
},
3637
"autoload": {

composer.lock

Lines changed: 24 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/cloudinary.php

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/CloudinaryServiceProvider.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,26 @@
22

33
namespace CloudinaryLabs\CloudinaryLaravel;
44

5+
use Cloudinary\Cloudinary;
6+
use Illuminate\Filesystem\FilesystemAdapter;
57
use Illuminate\Support\ServiceProvider;
8+
use League\Flysystem\Filesystem;
69

710
class CloudinaryServiceProvider extends ServiceProvider
811
{
912
public function boot(): void
1013
{
11-
//
14+
$this->app['filesystem']->extend('cloudinary', function ($app, $config) {
15+
$adapter = new CloudinaryStorageAdapter($config);
16+
17+
return new FilesystemAdapter(new Filesystem($adapter, $config), $adapter, $config);
18+
});
1219
}
1320

1421
public function register(): void
1522
{
16-
//
23+
$this->app->singleton(Cloudinary::class, function ($app) {
24+
return new Cloudinary($app['config']->get('cloudinary'));
25+
});
1726
}
1827
}

0 commit comments

Comments
 (0)