Yii2 ActiveQuery“哪里”不起作用

I'm learning Yii2 framework and PHP, and I can't find solution to my problem.

I have AR Model Project with many-to-many relation:

    public function getUsers() {
    return $this->hasMany(UserAR::className(), ['id' => 'user_id'])
        ->viaTable('user_project', ['project_id' => 'id']);
    }

I want to retrieve all projects with User of given ID, And reverse - all projects without this user. So far I tried it this way:

   $uid =  Yii::$app->user->id;
   $projects = Project::find()->all();
   foreach($projects as $p){
        $found = $p->getUsers()->where(['id'=>$uid])->all();
        echo"<pre>"; var_dump($found);
   }

but it returns NULL for every iteration, What I'm doing wrong?

Found solution, Somehow I tested from Administrative account which wasn't attached to any of my projects - that's why it returned null - when I changed $uid to correct Value, It worked as I desired. Thanks Chainarong Tangsurakit for pointing me in right direction.