MicroFrameWork/app/controllers/PostController.php
2024-07-08 16:20:25 +03:00

24 lines
421 B
PHP

<?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>";
}
}
}