bd
This commit is contained in:
0
src/ActiveForm.php
Normal file → Executable file
0
src/ActiveForm.php
Normal file → Executable file
0
src/Form.php
Normal file → Executable file
0
src/Form.php
Normal file → Executable file
5
src/JsonForm.php
Normal file → Executable file
5
src/JsonForm.php
Normal file → Executable file
@ -66,4 +66,9 @@ class JsonForm
|
||||
echo $this->html;
|
||||
}
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
return $this->html;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\app\controllers;
|
||||
|
||||
class Main
|
||||
{
|
||||
|
||||
public function indexAction(): void
|
||||
{
|
||||
echo 123;
|
||||
}
|
||||
|
||||
public function exampleAction()
|
||||
{
|
||||
echo "example";
|
||||
}
|
||||
|
||||
}
|
30
src/app/controllers/MainController.php
Executable file
30
src/app/controllers/MainController.php
Executable file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\app\controllers;
|
||||
|
||||
use itguild\forms\app\core\BaseController;
|
||||
use itguild\forms\debug\Debug;
|
||||
use itguild\forms\JsonForm;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
class MainController extends BaseController
|
||||
{
|
||||
private $html;
|
||||
|
||||
public function indexAction(): void
|
||||
{
|
||||
$this->view->addFunction(new TwigFunction("create_form", function (){
|
||||
$form = new JsonForm(file_get_contents("form.json"));
|
||||
$form->convertHTML();
|
||||
$form->render();
|
||||
}));
|
||||
|
||||
echo $this->view->render('main/index.html.twig', ['title' => 'Заголовок', 'content' => ""]);
|
||||
}
|
||||
|
||||
public function exampleAction()
|
||||
{
|
||||
echo "example";
|
||||
}
|
||||
|
||||
}
|
22
src/app/controllers/UserController.php
Normal file
22
src/app/controllers/UserController.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\app\controllers;
|
||||
|
||||
use itguild\forms\app\core\BaseController;
|
||||
use itguild\forms\app\models\User;
|
||||
use itguild\forms\debug\Debug;
|
||||
|
||||
class UserController extends BaseController
|
||||
{
|
||||
|
||||
public function createUserAction()
|
||||
{
|
||||
$user = User::Create([ 'name' => "Ahmed Khan", 'email' => "ahmed.khan@lbs.com", 'password' => password_hash("ahmedkhan",PASSWORD_BCRYPT), ]);
|
||||
}
|
||||
|
||||
public function getUserAction($id)
|
||||
{
|
||||
Debug::prn(User::find(1)->first()->email);
|
||||
}
|
||||
|
||||
}
|
17
src/app/core/BaseController.php
Normal file
17
src/app/core/BaseController.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\app\core;
|
||||
|
||||
class BaseController
|
||||
{
|
||||
protected $view;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$loader = new \Twig\Loader\FilesystemLoader(VIEW_PATH);
|
||||
$this->view = new \Twig\Environment($loader, [
|
||||
'cache' => VIEW_CACHE_PATH,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
19
src/app/models/User.php
Normal file
19
src/app/models/User.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace itguild\forms\app\models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $table = "user";
|
||||
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password','userimage'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'password', 'remember_token',
|
||||
];
|
||||
|
||||
}
|
0
src/builders/Builder.php
Normal file → Executable file
0
src/builders/Builder.php
Normal file → Executable file
0
src/builders/ButtonBuilder.php
Normal file → Executable file
0
src/builders/ButtonBuilder.php
Normal file → Executable file
0
src/builders/CheckBoxBuilder.php
Normal file → Executable file
0
src/builders/CheckBoxBuilder.php
Normal file → Executable file
0
src/builders/LabelBuilder.php
Normal file → Executable file
0
src/builders/LabelBuilder.php
Normal file → Executable file
0
src/builders/RadioButtonBuilder.php
Normal file → Executable file
0
src/builders/RadioButtonBuilder.php
Normal file → Executable file
0
src/builders/SelectBuilder.php
Normal file → Executable file
0
src/builders/SelectBuilder.php
Normal file → Executable file
0
src/builders/TextAreaBuilder.php
Normal file → Executable file
0
src/builders/TextAreaBuilder.php
Normal file → Executable file
0
src/builders/TextInputBuilder.php
Normal file → Executable file
0
src/builders/TextInputBuilder.php
Normal file → Executable file
0
src/debug/Debug.php
Normal file → Executable file
0
src/debug/Debug.php
Normal file → Executable file
0
src/inputs/BaseInput.php
Normal file → Executable file
0
src/inputs/BaseInput.php
Normal file → Executable file
0
src/inputs/Button.php
Normal file → Executable file
0
src/inputs/Button.php
Normal file → Executable file
0
src/inputs/Checkbox.php
Normal file → Executable file
0
src/inputs/Checkbox.php
Normal file → Executable file
0
src/inputs/Label.php
Normal file → Executable file
0
src/inputs/Label.php
Normal file → Executable file
0
src/inputs/RadioButton.php
Normal file → Executable file
0
src/inputs/RadioButton.php
Normal file → Executable file
0
src/inputs/Select.php
Normal file → Executable file
0
src/inputs/Select.php
Normal file → Executable file
0
src/inputs/TextArea.php
Normal file → Executable file
0
src/inputs/TextArea.php
Normal file → Executable file
0
src/inputs/TextInput.php
Normal file → Executable file
0
src/inputs/TextInput.php
Normal file → Executable file
0
src/mappers/JsonInputMapper.php
Normal file → Executable file
0
src/mappers/JsonInputMapper.php
Normal file → Executable file
30
src/migrations/UserMigration.php
Normal file
30
src/migrations/UserMigration.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\migrations;
|
||||
use Illuminate;
|
||||
|
||||
class UserMigration
|
||||
{
|
||||
|
||||
public static function up(): void
|
||||
{
|
||||
|
||||
Illuminate\Database\Capsule\Manager::schema()->create("user", function ($table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->string('password');
|
||||
$table->string('userimage')->nullable();
|
||||
$table->string('api_key')->nullable()->unique();
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static function down(): void
|
||||
{
|
||||
Illuminate\Database\Capsule\Manager::schema()->drop("user");
|
||||
}
|
||||
|
||||
}
|
0
src/templates/Simple/SimpleTemplate.php
Normal file → Executable file
0
src/templates/Simple/SimpleTemplate.php
Normal file → Executable file
0
src/templates/Template.php
Normal file → Executable file
0
src/templates/Template.php
Normal file → Executable file
0
src/templates/bootstrap5/Bootstrap5Template.php
Normal file → Executable file
0
src/templates/bootstrap5/Bootstrap5Template.php
Normal file → Executable file
0
src/traits/CreateOption.php
Normal file → Executable file
0
src/traits/CreateOption.php
Normal file → Executable file
0
src/traits/CreateParams.php
Normal file → Executable file
0
src/traits/CreateParams.php
Normal file → Executable file
Reference in New Issue
Block a user