@@ -19,50 +19,68 @@ public function boot()
1919 }
2020 }
2121
22+ /**
23+ * Register the application services.
24+ */
25+ public function register ()
26+ {
27+ $ this ->mergeConfigFrom (__DIR__ .'/../config/config.php ' , 's3-browser-based-uploads ' );
28+
29+ $ this ->app ->bind (S3BrowserBasedUploadsManager::class, function () {
30+ $ adapter = $ this ->getS3Adapter ();
31+
32+ return new S3BrowserBasedUploadsManager (
33+ $ adapter ->getClient (),
34+ $ adapter ->getBucket (),
35+ $ this ->getInputs (),
36+ $ this ->getConditions (),
37+ $ this ->getExpirationTime ()
38+ );
39+ });
40+
41+ $ this ->app ->alias (S3BrowserBasedUploadsManager::class, 's3-browser-based-uploads ' );
42+ }
43+
44+
45+ /**
46+ * @return AwsS3Adapter
47+ */
2248 protected function getS3Adapter () : AwsS3Adapter
2349 {
2450 return $ this ->app ['filesystem ' ]->disk ($ this ->getConfig ('disk ' ))->getAdapter ();
2551 }
2652
53+ /**
54+ * returns inputs from config file
55+ */
2756 protected function getInputs () : array
2857 {
2958 return $ this ->getConfig ('inputs ' , []);
3059 }
3160
61+ /**
62+ * returns conditions from config file
63+ */
3264 protected function getConditions () : array
3365 {
3466 return $ this ->getConfig ('conditions ' , []);
3567 }
3668
69+ /**
70+ * returns expiration time from config file
71+ */
3772 protected function getExpirationTime () : string
3873 {
3974 return $ this ->getConfig ('expiration_time ' , '+5 minutes ' );
4075 }
4176
42- public function getConfig (string $ key , $ default = null )
43- {
44- return config ('s3-browser-based-uploads.providers.default. ' . $ key , $ default );
45- }
46-
4777 /**
48- * Register the application services.
78+ * @param string $key
79+ * @param null $default
80+ * @return mixed
4981 */
50- public function register ( )
82+ protected function getConfig ( string $ key , $ default = null )
5183 {
52- $ this ->mergeConfigFrom (__DIR__ .'/../config/config.php ' , 's3-browser-based-uploads ' );
53-
54- $ this ->app ->bind (S3BrowserBasedUploadsManager::class, function () {
55- $ adapter = $ this ->getS3Adapter ();
56-
57- return new S3BrowserBasedUploadsManager (
58- $ adapter ->getClient (),
59- $ adapter ->getBucket (),
60- $ this ->getInputs (),
61- $ this ->getConditions (),
62- $ this ->getExpirationTime ()
63- );
64- });
65-
66- $ this ->app ->alias (S3BrowserBasedUploadsManager::class, 's3-browser-based-uploads ' );
84+ return config ('s3-browser-based-uploads.providers.default. ' . $ key , $ default );
6785 }
6886}
0 commit comments