-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switched storage from s3 to google drive
- Loading branch information
1 parent
aef9320
commit 99a018e
Showing
12 changed files
with
983 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
namespace App\Providers; | ||
class GoogleDriveAdapter extends \Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter | ||
{ | ||
public function getService() | ||
{ | ||
return $this->service; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
namespace App\Providers; | ||
use Illuminate\Support\ServiceProvider; | ||
class GoogleDriveServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Bootstrap the application services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
\Storage::extend('google', function($app, $config) { | ||
$client = new \Google_Client(); | ||
$client->setClientId($config['clientId']); | ||
$client->setClientSecret($config['clientSecret']); | ||
$client->refreshToken($config['refreshToken']); | ||
$service = new \Google_Service_Drive($client); | ||
$options = []; | ||
if(isset($config['teamDriveId'])) { | ||
$options['teamDriveId'] = $config['teamDriveId']; | ||
} | ||
$adapter = new GoogleDriveAdapter($service, $config['folderId'], $options); | ||
return new \League\Flysystem\Filesystem($adapter); | ||
}); | ||
} | ||
/** | ||
* Register the application services. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.