<?php namespace app\controllers; use app\helpers\Debug; use app\models\Post; class PostController { public function actionCreatePost($post, $user_id) { return Post::create(['post'=>$post, 'user_id'=>$user_id]); } public function actionIndex(): void { Debug::dd("Post list"); foreach (Post::all() as $post) { echo $post->post . "<br>"; } } }