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,7 +1,11 @@
<?php
namespace Controllers;
use Models\User;
use Models\Question;
namespace app\controllers;
use app\models\Question;
use app\models\User;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\DB;
class Users {
public function actionCreateUser($username, $email, $password)
@ -13,4 +17,22 @@ class Users {
{
return Question::where('user_id', $user_id)->count();
}
public function actionViewAllUsers(): void
{
foreach (User::all() as $user)
{
echo $user->username . "<br>";
}
}
public function actionViewUser(): void
{
echo User::where('id', '=', 13)->get();
// $user = User::where('id', '=', 13)->get();
// echo $user->username . "<br>";
// echo $user->email . "<br>";
// echo $user->created_at . "<br>";
}
}