Files
yii2-usuario/lib/User/Query/SocialNetworkAccountQuery.php
2016-12-09 01:39:55 +01:00

24 lines
520 B
PHP

<?php
namespace Da\User\Query;
use Da\User\Contracts\AuthClientInterface;
use yii\db\ActiveQuery;
class SocialNetworkAccountQuery extends ActiveQuery
{
public function whereClient(AuthClientInterface $client)
{
return $this->andWhere(
[
'provider' => $client->getId(),
'client_id' => $client->getUserAttributes()['id']
]
);
}
public function whereCode($code)
{
return $this->andWhere(['code' => md5($code)]);
}
}