Skip to content

Commit

Permalink
Merge pull request #1044 from afilippov1985/fix-auth-codes-table-cust…
Browse files Browse the repository at this point in the history
…omization

[8.0] Fix auth codes table customization
  • Loading branch information
taylorotwell authored Jul 9, 2019
2 parents a3a11b8 + 649d747 commit 839b842
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions src/Bridge/AuthCodeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,13 @@
namespace Laravel\Passport\Bridge;

use Laravel\Passport\Passport;
use Illuminate\Database\Connection;
use League\OAuth2\Server\Entities\AuthCodeEntityInterface;
use League\OAuth2\Server\Repositories\AuthCodeRepositoryInterface;

class AuthCodeRepository implements AuthCodeRepositoryInterface
{
use FormatsScopesForStorage;

/**
* The database connection.
*
* @var \Illuminate\Database\Connection
*/
protected $database;

/**
* Create a new repository instance.
*
* @param \Illuminate\Database\Connection $database
* @return void
*/
public function __construct(Connection $database)
{
$this->database = $database;
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -59,16 +40,14 @@ public function persistNewAuthCode(AuthCodeEntityInterface $authCodeEntity)
*/
public function revokeAuthCode($codeId)
{
$this->database->table(Passport::authCode()->getTable())
->where('id', $codeId)->update(['revoked' => true]);
Passport::authCode()->where('id', $codeId)->update(['revoked' => true]);
}

/**
* {@inheritdoc}
*/
public function isAuthCodeRevoked($codeId)
{
return $this->database->table(Passport::authCode()->getTable())
->where('id', $codeId)->where('revoked', 1)->exists();
return Passport::authCode()->where('id', $codeId)->where('revoked', 1)->exists();
}
}

0 comments on commit 839b842

Please sign in to comment.