test routing
This commit is contained in:
@ -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>";
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user