create beta
This commit is contained in:
parent
910bf56766
commit
094e047a5c
@ -19,15 +19,28 @@ use Twig\TwigFunction;
|
||||
class UserController extends Controller{
|
||||
public function actionCreate(): void
|
||||
{
|
||||
// $loader = new \Twig\Loader\FilesystemLoader(__DIR__.'/../views');
|
||||
// $twig = new \Twig\Environment($loader, ['cache' => 'app/views/cache']);
|
||||
echo $this->twig->render('user_create.html.twig');
|
||||
}
|
||||
|
||||
public function actionAdd(): void
|
||||
{
|
||||
$_REQUEST["password_hash"] = password_hash($_REQUEST["password_hash"], PASSWORD_DEFAULT);
|
||||
|
||||
foreach ($_REQUEST as $key => $value)
|
||||
{
|
||||
// Debug::prn(User::where([$key => $value])->get()->toArray());
|
||||
// Debug::prn($user);
|
||||
// Debug::dd($user->toArray());
|
||||
if (User::where([$key => $value])->get()->toArray() !== null)
|
||||
{
|
||||
header("Location: http://itguild-framework.loc/admin/user/create");
|
||||
}
|
||||
else
|
||||
{
|
||||
User::create($_REQUEST);
|
||||
header("Location: http://itguild-framework.loc/admin/user/");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function actionQuestionCount($user_id)
|
||||
@ -64,6 +77,7 @@ class UserController extends Controller{
|
||||
public function actionView($id): void
|
||||
{
|
||||
$user = User::find($id);
|
||||
|
||||
if (!$user){
|
||||
throw new Exception(message: "The user not found");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user