src/AuthTraits/OAuthTrait.php
public function applyScopesToUser($user, array $scopes)
	{
		if (! is_a($user, Model::class)) {
			$this->fail('User is not a model.');
		}

		$scopes = array_map(
			function ($scope) {
				return ['oauth_scope_id' => $scope];
			}, $scopes
		);

		$user->scopes()->attach($scopes);

		return $user->fresh(['scopes']);
	}
public function applyScopesToUser($user, array $scopes)
	{
		if (! is_a($user, Model::class)) {
			$this->fail('User is not a model.');
		}

		$scopes = array_map(
			function ($scope) {
				return ['oauth_scope_id' => $scope];
			}, $scopes
		);

		$user->scopes()->attach($scopes);

		return $user->fresh(['scopes']);
	}
public function applyScopesToUser ( $ user , array $ scopes ) { if ( ! is_a ( $ user , Model :: class ) ) { $ this -> fail ( 'User is not a model.' ) ; } $ scopes = array_map ( function ( $ scope ) { return [ 'oauth_scope_id' => $ scope ] ; } , $ scopes ) ; $ user -> scopes ( ) -> attach ( $ scopes ) ; return $ user -> fresh ( [ 'scopes' ] ) ; }
Attach scopes to a user

@param object $user
@param array  $scopes
Attach scopes to a user