Skip to content

Commit

Permalink
SMartins\PassportMultiauth Support
Browse files Browse the repository at this point in the history
  • Loading branch information
pedmindset committed Aug 31, 2018
1 parent b37f70e commit a4fc478
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 20 deletions.
42 changes: 22 additions & 20 deletions src/CouchbasePassportServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Pedmindset\Couchbase\Passport\Token;
use Pedmindset\Couchbase\Passport\TokenRepository;
use Pedmindset\Couchbase\Passport\RefreshTokenRepository;

use Pedmindset\Couchbase\Passport\Provider;


class CouchbasePassportServiceProvider extends ServiceProvider
Expand All @@ -19,24 +19,26 @@ public function register()
/*
* Passport client extends Eloquent model by default, so we alias them.
*/
if (class_exists('Illuminate\Foundation\AliasLoader')) {
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('Laravel\Passport\AuthCode', AuthCode::class);
$loader->alias('Laravel\Passport\Client', Client::class);
$loader->alias('Laravel\Passport\PersonalAccessClient', PersonalAccessClient::class);
$loader->alias('Laravel\Passport\Token', Token::class);
$loader->alias('Laravel\Passport\TokenRepository', TokenRepository::class);
$loader->alias('Laravel\Passport\Bridge\RefreshTokenRepository', RefreshTokenRepository::class);

} else {
class_alias('Laravel\Passport\AuthCode', AuthCode::class);
class_alias('Laravel\Passport\Client', Client::class);
class_alias('Laravel\Passport\PersonalAccessClient', PersonalAccessClient::class);
class_alias('Laravel\Passport\Token', Token::class);
class_alias('Laravel\Passport\TokenRepository', TokenRepository::class);
class_alias('Laravel\Passport\Bridge\RefreshTokenRepository', RefreshTokenRepository::class);


}
if (class_exists('Illuminate\Foundation\AliasLoader')) {
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('Laravel\Passport\AuthCode', AuthCode::class);
$loader->alias('Laravel\Passport\Client', Client::class);
$loader->alias('Laravel\Passport\PersonalAccessClient', PersonalAccessClient::class);
$loader->alias('Laravel\Passport\Token', Token::class);
$loader->alias('Laravel\Passport\TokenRepository', TokenRepository::class);
$loader->alias('Laravel\Passport\Bridge\RefreshTokenRepository', RefreshTokenRepository::class);
$loader->alias('Laravel\Passport\Bridge\RefreshTokenRepository', RefreshTokenRepository::class);
$loader->alias('SMartins\PassportMultiauth\Provider', Provider::class);


} else {
class_alias('Laravel\Passport\AuthCode', AuthCode::class);
class_alias('Laravel\Passport\Client', Client::class);
class_alias('Laravel\Passport\PersonalAccessClient', PersonalAccessClient::class);
class_alias('Laravel\Passport\Token', Token::class);
class_alias('Laravel\Passport\TokenRepository', TokenRepository::class);
class_alias('Laravel\Passport\Bridge\RefreshTokenRepository', RefreshTokenRepository::class);
class_alias('SMartins\PassportMultiauth\Provider', Provider::class);
}
}
}
25 changes: 25 additions & 0 deletions src/Passport/Provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Pedmindset\Couchbase\Passport;

use Mpociot\Couchbase\Eloquent\Model;

/**
* @property string $provider The provider related with access token
*/
class Provider extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'oauth_access_token_providers';

/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'oauth_access_token_id';
}

0 comments on commit a4fc478

Please sign in to comment.