routing
This commit is contained in:
18
app/controllers/MainController.php
Normal file
18
app/controllers/MainController.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace app\controllers;
|
||||
|
||||
class MainController
|
||||
{
|
||||
|
||||
public function actionIndex(): void
|
||||
{
|
||||
echo "<h1>Главная страница</h1>";
|
||||
}
|
||||
|
||||
public function actionExample(): void
|
||||
{
|
||||
echo "<h1>Example</h1>";
|
||||
}
|
||||
|
||||
}
|
@ -4,12 +4,12 @@ use Models\User;
|
||||
use Models\Question;
|
||||
|
||||
class Users {
|
||||
public static function create_user($username, $email, $password)
|
||||
public function actionCreateUser($username, $email, $password)
|
||||
{
|
||||
return User::create(['username'=>$username,'email'=>$email,'password'=>$password]);
|
||||
}
|
||||
|
||||
public static function question_count($user_id)
|
||||
public function actionQuestionCount($user_id)
|
||||
{
|
||||
return Question::where('user_id', $user_id)->count();
|
||||
}
|
||||
|
Reference in New Issue
Block a user