Permalink
Browse files

✨ Add Google as a service

  • Loading branch information...
lorisleiva committed Aug 17, 2018
1 parent 6b9fe65 commit f6639340f588d49dce5fb8c33f98148c0a14882c
Showing with 616 additions and 1 deletion.
  1. +5 βˆ’0 .env.example
  2. +37 βˆ’0 app/Services/Google.php
  3. +1 βˆ’0 composer.json
  4. +559 βˆ’1 composer.lock
  5. +13 βˆ’0 config/services.php
  6. +1 βˆ’0 public/google2692c85694f49cc2.html
View
@@ -37,3 +37,8 @@ PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URI="${APP_URL}/google/oauth"
GOOGLE_WEBHOOK_URI="${APP_URL}/google/webhook"
View
@@ -0,0 +1,37 @@
<?php
namespace App\Services;
class Google
{
protected $client;
function __construct()
{
$client = new \Google_Client();
$client->setClientId(config('services.google.client_id'));
$client->setClientSecret(config('services.google.client_secret'));
$client->setRedirectUri(config('services.google.redirect_uri'));
$client->setScopes(config('services.google.scopes'));
$client->setApprovalPrompt(config('services.google.approval_prompt'));
$client->setAccessType(config('services.google.access_type'));
$client->setIncludeGrantedScopes(config('services.google.include_granted_scopes'));
$this->client = $client;
}
public function service($service)
{
$classname = "Google_Service_$service";
return new $classname($this->client);
}
public function __call($method, $args)
{
if (! method_exists($this->client, $method)) {
throw new \Exception("Call to undefined method '{$method}'");
}
return call_user_func_array([$this->client, $method], $args);
}
}
View
@@ -7,6 +7,7 @@
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"google/apiclient": "^2.2",
"laravel/framework": "5.6.*",
"laravel/tinker": "^1.0"
},
Oops, something went wrong.

0 comments on commit f663934

Please sign in to comment.