Skip to content

Instantly share code, notes, and snippets.

@orobogenius
Created April 9, 2019 23:31
Show Gist options
  • Save orobogenius/fc977891d5b365dec8b0981d47546a46 to your computer and use it in GitHub Desktop.
Save orobogenius/fc977891d5b365dec8b0981d47546a46 to your computer and use it in GitHub Desktop.
<?php
namespace App\OAuth\Bridge\Repositories;
use Laravel\Passport\Passport;
use League\OAuth2\Server\Entities\ClientEntityInterface;
use Laravel\Passport\Bridge\ScopeRepository as PassportScopeRepository;
class ScopeRepository extends PassportScopeRepository
{
/**
* {@inheritdoc}
*/
public function finalizeScopes(
array $scopes, $grantType,
ClientEntityInterface $clientEntity, $userIdentifier = null)
{
return collect($scopes)->filter(function ($scope) {
return Passport::hasScope($scope->getIdentifier());
})->values()->all();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment