mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-04 20:48:59 +05:30
31 lines
825 B
PHP
31 lines
825 B
PHP
<?php
|
|
|
|
namespace RelationalExample\Storage;
|
|
|
|
use Illuminate\Database\Capsule\Manager as Capsule;
|
|
use League\OAuth2\Server\Entity\ScopeEntity;
|
|
use League\OAuth2\Server\Storage\AbstractStorage;
|
|
use League\OAuth2\Server\Storage\ScopeInterface;
|
|
|
|
class ScopeStorage extends AbstractStorage implements ScopeInterface
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function get($scope, $grantType = null, $clientId = null)
|
|
{
|
|
$result = Capsule::table('oauth_scopes')
|
|
->where('id', $scope)
|
|
->get();
|
|
|
|
if (count($result) === 0) {
|
|
return;
|
|
}
|
|
|
|
return (new ScopeEntity($this->server))->hydrate([
|
|
'id' => $result[0]['id'],
|
|
'description' => $result[0]['description'],
|
|
]);
|
|
}
|
|
}
|