test routing

This commit is contained in:
2024-07-05 13:49:04 +03:00
parent a482a508e4
commit 2f2310e739
6 changed files with 79 additions and 23 deletions

View File

@ -1,13 +1,22 @@
<?php
namespace Controllers;
namespace app\controllers;
use Models\Post;
use app\models\Post;
class Posts
{
public static function create_post($post, $user_id)
public function actionCreatePost($post, $user_id)
{
return Post::create(['post'=>$post, 'user_id'=>$user_id]);
}
public function actionViewAllPosts()
{
foreach (Post::all() as $post)
{
echo $post->post . "<br>";
}
}
}