没有从数据库接收所有数据,yii2

Controller action to render index page

public function actionIndex()
    {
        $posts = Posts::find()->all();
        $user = User::find()->all;
        return $this->render('index', [
            'posts' => $posts,
            'user' => $user
        ]);
    }

View:

<? foreach ($posts as $post){?>
    <div class="well">
        <h5><?=$user[$post->user_id-1]->login ?></h5>
        <?=$post->text ?>
    </div>
    <?} ?>

Posts texts are displayed but users logins not. Why? var_dump($users) shows nothing. I checked this table. There are some records in users table.

public function actionIndex()
{
    $posts = Posts::find()->all();
    $user = User::find()->all();
    return $this->render('index', [
        'posts' => $posts,
        'user' => $user
    ]);
}

use User::find()->all(); not User::find()->all;