06.10.2016 Views

laravel-5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Filesystem / Cloud Storage 366<br />

16 * @return void<br />

17 */<br />

18 public function boot()<br />

19 {<br />

20 Storage::extend('dropbox', function($app, $config) {<br />

21 $client = new DropboxClient(<br />

22 $config['accessToken'], $config['clientIdentifier']<br />

23 );<br />

24<br />

25 return new Filesystem(new DropboxAdapter($client));<br />

26 });<br />

27 }<br />

28<br />

29 /**<br />

30 * Register bindings in the container.<br />

31 *<br />

32 * @return void<br />

33 */<br />

34 public function register()<br />

35 {<br />

36 //<br />

37 }<br />

38 }<br />

The first argument of the extend method is the name of the driver and the second is a Closure<br />

that receives the $app and $config variables. The resolver Closure must return an instance of<br />

League\Flysystem\Filesystem. The $config variable contains the values defined in config/-<br />

filesystems.php for the specified disk.<br />

Once you have created the service provider to register the extension, you may use the dropbox driver<br />

in your config/filesystem.php configuration file.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!