twig
This commit is contained in:
parent
3df81597b6
commit
ab0db2b320
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
.idea
|
.idea
|
||||||
vendor
|
vendor
|
||||||
.env
|
.env
|
||||||
|
cache
|
14
app/controllers/Controller.php
Normal file
14
app/controllers/Controller.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\controllers;
|
||||||
|
|
||||||
|
class Controller
|
||||||
|
{
|
||||||
|
protected \Twig\Loader\FilesystemLoader $loader;
|
||||||
|
protected \Twig\Environment $twig;
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->loader = new \Twig\Loader\FilesystemLoader(__DIR__.'/../views');
|
||||||
|
$this->twig = new \Twig\Environment($this->loader, ['cache' => 'app/views/cache']);
|
||||||
|
}
|
||||||
|
}
|
@ -3,10 +3,10 @@ namespace app\controllers;
|
|||||||
|
|
||||||
use app\models\Question;
|
use app\models\Question;
|
||||||
|
|
||||||
class QuestionController{
|
class QuestionController extends Controller{
|
||||||
public function actionCreate()
|
public function actionCreate()
|
||||||
{
|
{
|
||||||
require "app/views/questionCreate.php";
|
echo $this->twig->render('questionCreate.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionGetQuestionsWithAnswers()
|
public function actionGetQuestionsWithAnswers()
|
||||||
|
@ -6,10 +6,12 @@ use app\helpers\Debug;
|
|||||||
use app\models\Question;
|
use app\models\Question;
|
||||||
use app\models\User;
|
use app\models\User;
|
||||||
|
|
||||||
class UserController {
|
class UserController extends Controller{
|
||||||
public function actionCreate(): void
|
public function actionCreate(): void
|
||||||
{
|
{
|
||||||
require "app/views/userCreate.php";
|
// $loader = new \Twig\Loader\FilesystemLoader(__DIR__.'/../views');
|
||||||
|
// $twig = new \Twig\Environment($loader, ['cache' => 'app/views/cache']);
|
||||||
|
echo $this->twig->render('userCreate.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionAdd(): void
|
public function actionAdd(): void
|
||||||
@ -25,10 +27,15 @@ class UserController {
|
|||||||
|
|
||||||
public function actionIndex(): void
|
public function actionIndex(): void
|
||||||
{
|
{
|
||||||
|
// $loader = new \Twig\Loader\FilesystemLoader(__DIR__.'/../views');
|
||||||
|
// $twig = new \Twig\Environment($loader, ['cache' => 'app/views/cache']);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
foreach (User::all() as $user)
|
foreach (User::all() as $user)
|
||||||
{
|
{
|
||||||
echo $user->username . "<br>";
|
$userArr[$i++] = $user;
|
||||||
}
|
}
|
||||||
|
echo $this->twig->render('userTable.html', ['userArr' => $userArr]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionView($id): void
|
public function actionView($id): void
|
||||||
@ -46,16 +53,19 @@ class UserController {
|
|||||||
|
|
||||||
public function actionUpdate(): void
|
public function actionUpdate(): void
|
||||||
{
|
{
|
||||||
Debug::prn("Update");
|
// $loader = new \Twig\Loader\FilesystemLoader(__DIR__.'/../views');
|
||||||
require "app/views/userUpdate.php";
|
// $twig = new \Twig\Environment($loader, ['cache' => 'app/views/cache']);
|
||||||
|
echo $this->twig->render('userUpdate.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionEdit(): void
|
public function actionEdit(): void
|
||||||
{
|
{
|
||||||
|
$_REQUEST["password_hash"] = password_hash($_REQUEST["password_hash"], PASSWORD_DEFAULT);
|
||||||
|
|
||||||
$user = User::find($_REQUEST['id']);
|
$user = User::find($_REQUEST['id']);
|
||||||
$user->username = $_REQUEST['username'];
|
$user->username = $_REQUEST['username'];
|
||||||
$user->email = $_REQUEST['email'];
|
$user->email = $_REQUEST['email'];
|
||||||
$user->password = $_REQUEST['password'];
|
$user->password_hash = $_REQUEST['password_hash'];
|
||||||
$user->save();
|
$user->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
app/views/mainLayout.html
Normal file
14
app/views/mainLayout.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ru-RU">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Примеры шаблонизатора Twig</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>HEADER</h1>
|
||||||
|
{% block content %}
|
||||||
|
{% endblock %}
|
||||||
|
<h1>FOOTER</h1>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,3 +1,6 @@
|
|||||||
|
{% extends "mainLayout.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
<form action="/admin/question" method="post">
|
<form action="/admin/question" method="post">
|
||||||
Вопрос: <br>
|
Вопрос: <br>
|
||||||
<label>
|
<label>
|
||||||
@ -6,4 +9,5 @@
|
|||||||
|
|
||||||
<input type = "submit" value="Подтвердить">
|
<input type = "submit" value="Подтвердить">
|
||||||
<input type="reset">
|
<input type="reset">
|
||||||
</form>
|
</form>
|
||||||
|
{% endblock %}
|
@ -1,3 +1,6 @@
|
|||||||
|
{% extends "mainLayout.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
<form action="/admin/user/" method="post">
|
<form action="/admin/user/" method="post">
|
||||||
Логин:<br>
|
Логин:<br>
|
||||||
<label>
|
<label>
|
||||||
@ -11,9 +14,10 @@
|
|||||||
|
|
||||||
Email адрес: <br>
|
Email адрес: <br>
|
||||||
<label>
|
<label>
|
||||||
<input type="Email" name="email" required>
|
<input type="Email" name="email" required placeholder="Email">
|
||||||
</label> <br><br>
|
</label> <br><br>
|
||||||
|
|
||||||
<input type = "submit" value="Подтвердить">
|
<input type = "submit" value="Подтвердить">
|
||||||
<input type="reset">
|
<input type="reset">
|
||||||
</form>
|
</form>
|
||||||
|
{% endblock %}
|
26
app/views/userTable.html
Normal file
26
app/views/userTable.html
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{% extends "mainLayout.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<table border="1" style="width: 80%;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>id</td>
|
||||||
|
<td>Username</td>
|
||||||
|
<td>Email</td>
|
||||||
|
<td>Created at</td>
|
||||||
|
<td>Updated at</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for users in userArr %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ users.id }}</td>
|
||||||
|
<td>{{ users.username }}</td>
|
||||||
|
<td>{{ users.email }}</td>
|
||||||
|
<td>{{ users.created_at }}</td>
|
||||||
|
<td>{{ users.updated_at }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
@ -1,3 +1,6 @@
|
|||||||
|
{% extends "mainLayout.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
<form action="/admin/user/edit" method="post">
|
<form action="/admin/user/edit" method="post">
|
||||||
id пользователя:<br>
|
id пользователя:<br>
|
||||||
<label>
|
<label>
|
||||||
@ -11,7 +14,7 @@
|
|||||||
|
|
||||||
Пароль:<br>
|
Пароль:<br>
|
||||||
<label>
|
<label>
|
||||||
<input type = "text" name = "password" required size="50" placeholder="Пароль">
|
<input type = "text" name = "password_hash" required size="50" placeholder="Пароль">
|
||||||
</label> <br> <br>
|
</label> <br> <br>
|
||||||
|
|
||||||
Email адрес: <br>
|
Email адрес: <br>
|
||||||
@ -21,4 +24,5 @@
|
|||||||
|
|
||||||
<input type = "submit" value="Подтвердить">
|
<input type = "submit" value="Подтвердить">
|
||||||
<input type="reset">
|
<input type="reset">
|
||||||
</form>
|
</form>
|
||||||
|
{% endblock %}
|
@ -5,7 +5,8 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"illuminate/database": "^11.14",
|
"illuminate/database": "^11.14",
|
||||||
"craft-group/phroute": "^2.1",
|
"craft-group/phroute": "^2.1",
|
||||||
"vlucas/phpdotenv": "^5.6"
|
"vlucas/phpdotenv": "^5.6",
|
||||||
|
"twig/twig": "^3.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
204
composer.lock
generated
204
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "0f18467a4a4a8e17b3a359c92f94a062",
|
"content-hash": "ec1e05ff0752e8d6ad1df75a5cae6188",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "brick/math",
|
"name": "brick/math",
|
||||||
@ -337,16 +337,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/collections",
|
"name": "illuminate/collections",
|
||||||
"version": "v11.14.0",
|
"version": "v11.15.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/collections.git",
|
"url": "https://github.com/illuminate/collections.git",
|
||||||
"reference": "358fd6dcce6927ee9d7cf520fa619f4597020d52"
|
"reference": "9bf68f03bbe05d38c9bd99bac8798c0de61f8478"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/collections/zipball/358fd6dcce6927ee9d7cf520fa619f4597020d52",
|
"url": "https://api.github.com/repos/illuminate/collections/zipball/9bf68f03bbe05d38c9bd99bac8798c0de61f8478",
|
||||||
"reference": "358fd6dcce6927ee9d7cf520fa619f4597020d52",
|
"reference": "9bf68f03bbe05d38c9bd99bac8798c0de61f8478",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -388,11 +388,11 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2024-06-28T20:14:10+00:00"
|
"time": "2024-07-02T20:54:37+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/conditionable",
|
"name": "illuminate/conditionable",
|
||||||
"version": "v11.14.0",
|
"version": "v11.15.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/conditionable.git",
|
"url": "https://github.com/illuminate/conditionable.git",
|
||||||
@ -438,16 +438,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/container",
|
"name": "illuminate/container",
|
||||||
"version": "v11.14.0",
|
"version": "v11.15.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/container.git",
|
"url": "https://github.com/illuminate/container.git",
|
||||||
"reference": "280405e0b577504b97feae0e7c7f5399816ccff1"
|
"reference": "49183db6643a7efbe9902ca379b8f8a55c802f88"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/container/zipball/280405e0b577504b97feae0e7c7f5399816ccff1",
|
"url": "https://api.github.com/repos/illuminate/container/zipball/49183db6643a7efbe9902ca379b8f8a55c802f88",
|
||||||
"reference": "280405e0b577504b97feae0e7c7f5399816ccff1",
|
"reference": "49183db6643a7efbe9902ca379b8f8a55c802f88",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -485,20 +485,20 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2024-07-02T15:41:17+00:00"
|
"time": "2024-07-03T21:04:00+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/contracts",
|
"name": "illuminate/contracts",
|
||||||
"version": "v11.14.0",
|
"version": "v11.15.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/contracts.git",
|
"url": "https://github.com/illuminate/contracts.git",
|
||||||
"reference": "eb8ccfbc5905c5631712d157cccdd7bc9db692e0"
|
"reference": "be935e9d9115a57be74d20176f43fa8a207029f3"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/contracts/zipball/eb8ccfbc5905c5631712d157cccdd7bc9db692e0",
|
"url": "https://api.github.com/repos/illuminate/contracts/zipball/be935e9d9115a57be74d20176f43fa8a207029f3",
|
||||||
"reference": "eb8ccfbc5905c5631712d157cccdd7bc9db692e0",
|
"reference": "be935e9d9115a57be74d20176f43fa8a207029f3",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -533,20 +533,20 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2024-07-01T21:58:24+00:00"
|
"time": "2024-07-09T13:57:38+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/database",
|
"name": "illuminate/database",
|
||||||
"version": "v11.14.0",
|
"version": "v11.15.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/database.git",
|
"url": "https://github.com/illuminate/database.git",
|
||||||
"reference": "6576f6fcc871a6ad173b6e246e8d2c63cd7cfe1a"
|
"reference": "9b7b13d2d9175ae9c07d4744d8f7d5b07e7264a7"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/database/zipball/6576f6fcc871a6ad173b6e246e8d2c63cd7cfe1a",
|
"url": "https://api.github.com/repos/illuminate/database/zipball/9b7b13d2d9175ae9c07d4744d8f7d5b07e7264a7",
|
||||||
"reference": "6576f6fcc871a6ad173b6e246e8d2c63cd7cfe1a",
|
"reference": "9b7b13d2d9175ae9c07d4744d8f7d5b07e7264a7",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -601,11 +601,11 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2024-07-02T15:56:54+00:00"
|
"time": "2024-07-08T15:08:27+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/macroable",
|
"name": "illuminate/macroable",
|
||||||
"version": "v11.14.0",
|
"version": "v11.15.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/macroable.git",
|
"url": "https://github.com/illuminate/macroable.git",
|
||||||
@ -651,16 +651,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/support",
|
"name": "illuminate/support",
|
||||||
"version": "v11.14.0",
|
"version": "v11.15.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/support.git",
|
"url": "https://github.com/illuminate/support.git",
|
||||||
"reference": "a8f299ed76d52fc048decada3571628e65fa5c41"
|
"reference": "b551f6cbecc607bcaf520eb3fc1933db9b1398f2"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/support/zipball/a8f299ed76d52fc048decada3571628e65fa5c41",
|
"url": "https://api.github.com/repos/illuminate/support/zipball/b551f6cbecc607bcaf520eb3fc1933db9b1398f2",
|
||||||
"reference": "a8f299ed76d52fc048decada3571628e65fa5c41",
|
"reference": "b551f6cbecc607bcaf520eb3fc1933db9b1398f2",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -721,7 +721,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2024-07-01T21:58:57+00:00"
|
"time": "2024-07-08T14:46:56+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nesbot/carbon",
|
"name": "nesbot/carbon",
|
||||||
@ -1130,6 +1130,73 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-05-31T14:57:53+00:00"
|
"time": "2024-05-31T14:57:53+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/deprecation-contracts",
|
||||||
|
"version": "v3.5.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/deprecation-contracts.git",
|
||||||
|
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
|
||||||
|
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-main": "3.5-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/contracts",
|
||||||
|
"url": "https://github.com/symfony/contracts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"function.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A generic function and convention to trigger deprecation notices",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-04-18T09:32:20+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-ctype",
|
"name": "symfony/polyfill-ctype",
|
||||||
"version": "v1.30.0",
|
"version": "v1.30.0",
|
||||||
@ -1617,6 +1684,85 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-04-18T09:32:20+00:00"
|
"time": "2024-04-18T09:32:20+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "twig/twig",
|
||||||
|
"version": "v3.10.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/twigphp/Twig.git",
|
||||||
|
"reference": "67f29781ffafa520b0bbfbd8384674b42db04572"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/twigphp/Twig/zipball/67f29781ffafa520b0bbfbd8384674b42db04572",
|
||||||
|
"reference": "67f29781ffafa520b0bbfbd8384674b42db04572",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.2.5",
|
||||||
|
"symfony/deprecation-contracts": "^2.5|^3",
|
||||||
|
"symfony/polyfill-ctype": "^1.8",
|
||||||
|
"symfony/polyfill-mbstring": "^1.3",
|
||||||
|
"symfony/polyfill-php80": "^1.22"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"psr/container": "^1.0|^2.0",
|
||||||
|
"symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"src/Resources/core.php",
|
||||||
|
"src/Resources/debug.php",
|
||||||
|
"src/Resources/escaper.php",
|
||||||
|
"src/Resources/string_loader.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Twig\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com",
|
||||||
|
"homepage": "http://fabien.potencier.org",
|
||||||
|
"role": "Lead Developer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Twig Team",
|
||||||
|
"role": "Contributors"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Armin Ronacher",
|
||||||
|
"email": "armin.ronacher@active-4.com",
|
||||||
|
"role": "Project Founder"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Twig, the flexible, fast, and secure template language for PHP",
|
||||||
|
"homepage": "https://twig.symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"templating"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/twigphp/Twig/issues",
|
||||||
|
"source": "https://github.com/twigphp/Twig/tree/v3.10.3"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/twig/twig",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-05-16T10:04:27+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "vlucas/phpdotenv",
|
"name": "vlucas/phpdotenv",
|
||||||
"version": "v5.6.0",
|
"version": "v5.6.0",
|
||||||
@ -1784,5 +1930,5 @@
|
|||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.3.0"
|
"plugin-api-version": "2.6.0"
|
||||||
}
|
}
|
||||||
|
25
index.php
25
index.php
@ -14,7 +14,6 @@ use app\controllers\PostController;
|
|||||||
use app\helpers\Debug;
|
use app\helpers\Debug;
|
||||||
use Phroute\Phroute\RouteCollector;
|
use Phroute\Phroute\RouteCollector;
|
||||||
|
|
||||||
|
|
||||||
$router = new RouteCollector();
|
$router = new RouteCollector();
|
||||||
$router->get('/', [MainController::class, 'actionIndex']);
|
$router->get('/', [MainController::class, 'actionIndex']);
|
||||||
$router->get('/example', [MainController::class, 'actionExample']);
|
$router->get('/example', [MainController::class, 'actionExample']);
|
||||||
@ -28,18 +27,18 @@ $router->group(["prefix" => "admin"], function (RouteCollector $router){
|
|||||||
$router->post("/", [\app\controllers\UserController::class, 'actionAdd']);
|
$router->post("/", [\app\controllers\UserController::class, 'actionAdd']);
|
||||||
$router->post("/edit", [\app\controllers\UserController::class, 'actionEdit']);
|
$router->post("/edit", [\app\controllers\UserController::class, 'actionEdit']);
|
||||||
});
|
});
|
||||||
$router->group(["prefix" => "question"], function (RouteCollector $router){
|
// $router->group(["prefix" => "question"], function (RouteCollector $router){
|
||||||
$router->get('/create', [QuestionController::class, 'actionCreate']);
|
// $router->get('/create', [QuestionController::class, 'actionCreate']);
|
||||||
$router->get('/update', [QuestionController::class, 'actionUpdate']);
|
// $router->get('/update', [QuestionController::class, 'actionUpdate']);
|
||||||
$router->get('/delete/{id}', [QuestionController::class, 'actionDelete']);
|
// $router->get('/delete/{id}', [QuestionController::class, 'actionDelete']);
|
||||||
$router->get('/', [QuestionController::class, 'actionIndex']);
|
// $router->get('/', [QuestionController::class, 'actionIndex']);
|
||||||
$router->get('/{id}', [QuestionController::class, 'actionView']);
|
// $router->get('/{id}', [QuestionController::class, 'actionView']);
|
||||||
$router->post("/", [QuestionController::class, 'actionAdd']);
|
// $router->post("/", [QuestionController::class, 'actionAdd']);
|
||||||
$router->post("/edit", [QuestionController::class, 'actionEdit']);
|
// $router->post("/edit", [QuestionController::class, 'actionEdit']);
|
||||||
});
|
// });
|
||||||
$router->group(["prefix" => "post"], function (RouteCollector $router){
|
// $router->group(["prefix" => "post"], function (RouteCollector $router){
|
||||||
$router->get('/', [\app\controllers\PostController::class, 'actionIndex']);
|
// $router->get('/', [\app\controllers\PostController::class, 'actionIndex']);
|
||||||
});
|
// });
|
||||||
});
|
});
|
||||||
|
|
||||||
$router->get('/allQuestions', [QuestionController::class, 'actionViewAllQuestions']);
|
$router->get('/allQuestions', [QuestionController::class, 'actionViewAllQuestions']);
|
||||||
|
Loading…
Reference in New Issue
Block a user