I have this code to find a user from db which status is active and role is user
public static function findByUsername($username)
{
return static::find([\'userna
You can pass custom where clause like this:
andWhere(['!=', 'field', 'value'])
Your final function will look like:
public static function findByUsername($username)
{
return static::find()
->where([
'username' => $username,
'status' => static::STATUS_ACTIVE
])
->andWhere(['!=', 'role', 'user'])
->all();
}