File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * @link https://github.com/phpviet/laravel-flysystem
4+ * @copyright (c) PHP Viet
5+ * @license [MIT](http://www.opensource.org/licenses/MIT)
6+ */
7+
8+ namespace PHPViet \Laravel \Flysystem ;
9+
10+ use Closure ;
11+ use Illuminate \Support \ServiceProvider ;
12+ use Illuminate \Filesystem \FilesystemManager ;
13+ use PHPViet \Laravel \Flysystem \Drivers \Viettel \Driver as ViettelDriver ;
14+
15+ /**
16+ * @author Vuong Minh <vuongxuongminh@gmail.com>
17+ * @since 1.0.0
18+ */
19+ class FlysystemServiceProvider extends ServiceProvider
20+ {
21+ /**
22+ * @var array
23+ */
24+ protected $ driversMap = [
25+ 'viettel ' => ViettelDriver::class,
26+ ];
27+
28+ public function register (): void
29+ {
30+ $ this ->registerDrivers ();
31+ }
32+
33+ protected function registerDrivers (): void
34+ {
35+ $ this ->app ->extend ('filesystem ' , function (FilesystemManager $ manager ) {
36+ foreach ($ this ->driversMap as $ driver => $ class ) {
37+ $ manager ->extend ($ driver , Closure::fromCallable (new $ class ()));
38+ }
39+
40+ return $ manager ;
41+ });
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments