From 432b2547cf80987e5ff1a41913479508b7ae018d Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 29 Mar 2024 17:47:46 +0300 Subject: [PATCH] bd --- .../14/14bb04555643336484373f73ae8830b9.php | 96 ------------- .../b6/b6a9b94df97efc8dc9336c36ada05909.php | 101 ------------- composer.json | 3 +- composer.lock | 133 +++++++++++++++++- console.php | 21 ++- index.php | 5 + src/app/controllers/FormController.php | 26 ++++ src/app/controllers/FormInputController.php | 16 +++ src/app/controllers/FormResController.php | 16 +++ src/app/controllers/InputTypeController.php | 16 +++ src/app/controllers/InputValueController.php | 16 +++ src/app/models/FormInputModel.php | 23 +++ src/app/models/FormModel.php | 23 +++ src/app/models/FormResModel.php | 18 +++ src/app/models/InputTypeModel.php | 18 +++ src/app/models/InputValueModel.php | 18 +++ src/migrations/FormsInputMigration.php | 33 +++++ src/migrations/FormsMigration.php | 31 ++++ src/migrations/FormsResMigration.php | 28 ++++ src/migrations/InputsTypeMigration.php | 25 ++++ src/migrations/InputsValueMigrations.php | 28 ++++ 21 files changed, 494 insertions(+), 200 deletions(-) delete mode 100755 compilation_cache/14/14bb04555643336484373f73ae8830b9.php delete mode 100755 compilation_cache/b6/b6a9b94df97efc8dc9336c36ada05909.php create mode 100644 src/app/controllers/FormController.php create mode 100644 src/app/controllers/FormInputController.php create mode 100644 src/app/controllers/FormResController.php create mode 100644 src/app/controllers/InputTypeController.php create mode 100644 src/app/controllers/InputValueController.php create mode 100644 src/app/models/FormInputModel.php create mode 100644 src/app/models/FormModel.php create mode 100644 src/app/models/FormResModel.php create mode 100644 src/app/models/InputTypeModel.php create mode 100644 src/app/models/InputValueModel.php create mode 100644 src/migrations/FormsInputMigration.php create mode 100644 src/migrations/FormsMigration.php create mode 100644 src/migrations/FormsResMigration.php create mode 100644 src/migrations/InputsTypeMigration.php create mode 100644 src/migrations/InputsValueMigrations.php diff --git a/compilation_cache/14/14bb04555643336484373f73ae8830b9.php b/compilation_cache/14/14bb04555643336484373f73ae8830b9.php deleted file mode 100755 index d39c722..0000000 --- a/compilation_cache/14/14bb04555643336484373f73ae8830b9.php +++ /dev/null @@ -1,96 +0,0 @@ -source = $this->getSourceContext(); - - $this->blocks = [ - 'title' => [$this, 'block_title'], - 'content' => [$this, 'block_content'], - ]; - } - - protected function doGetParent(array $context) - { - // line 1 - return "layouts/simple.html.twig"; - } - - protected function doDisplay(array $context, array $blocks = []) - { - $macros = $this->macros; - $this->parent = $this->loadTemplate("layouts/simple.html.twig", "main/index.html.twig", 1); - $this->parent->display($context, array_merge($this->blocks, $blocks)); - } - - // line 3 - public function block_title($context, array $blocks = []) - { - $macros = $this->macros; - echo twig_escape_filter($this->env, ($context["title"] ?? null), "html", null, true); - } - - // line 5 - public function block_content($context, array $blocks = []) - { - $macros = $this->macros; - // line 6 - echo " "; - echo twig_escape_filter($this->env, $this->env->getFunction('create_form')->getCallable()(), "html", null, true); - echo " - "; - // line 7 - echo twig_escape_filter($this->env, ($context["content"] ?? null), "html", null, true); - echo " -"; - } - - /** - * @codeCoverageIgnore - */ - public function getTemplateName() - { - return "main/index.html.twig"; - } - - /** - * @codeCoverageIgnore - */ - public function isTraitable() - { - return false; - } - - /** - * @codeCoverageIgnore - */ - public function getDebugInfo() - { - return array ( 63 => 7, 58 => 6, 54 => 5, 47 => 3, 36 => 1,); - } - - public function getSourceContext() - { - return new Source("", "main/index.html.twig", "/home/kali/php/untitled/views/main/index.html.twig"); - } -} diff --git a/compilation_cache/b6/b6a9b94df97efc8dc9336c36ada05909.php b/compilation_cache/b6/b6a9b94df97efc8dc9336c36ada05909.php deleted file mode 100755 index fb0d5fb..0000000 --- a/compilation_cache/b6/b6a9b94df97efc8dc9336c36ada05909.php +++ /dev/null @@ -1,101 +0,0 @@ -source = $this->getSourceContext(); - - $this->parent = false; - - $this->blocks = [ - 'title' => [$this, 'block_title'], - 'content' => [$this, 'block_content'], - ]; - } - - protected function doDisplay(array $context, array $blocks = []) - { - $macros = $this->macros; - // line 1 - echo " - - - - "; - // line 5 - $this->displayBlock('title', $context, $blocks); - echo " - - - - - -
-
-
- "; - // line 15 - $this->displayBlock('content', $context, $blocks); - // line 16 - echo "
- -
-
- - -"; - } - - // line 5 - public function block_title($context, array $blocks = []) - { - $macros = $this->macros; - } - - // line 15 - public function block_content($context, array $blocks = []) - { - $macros = $this->macros; - } - - /** - * @codeCoverageIgnore - */ - public function getTemplateName() - { - return "layouts/simple.html.twig"; - } - - /** - * @codeCoverageIgnore - */ - public function getDebugInfo() - { - return array ( 76 => 15, 70 => 5, 60 => 16, 58 => 15, 45 => 5, 39 => 1,); - } - - public function getSourceContext() - { - return new Source("", "layouts/simple.html.twig", "/home/kali/php/untitled/views/layouts/simple.html.twig"); - } -} diff --git a/composer.json b/composer.json index 0e15c5b..9e6bf03 100755 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "craft-group/phroute": "^2.1", "twig/twig": "^3.0", "illuminate/database": "^11.0", - "vlucas/phpdotenv": "^5.6" + "vlucas/phpdotenv": "^5.6", + "illuminate/filesystem": "^11.1" } } diff --git a/composer.lock b/composer.lock index 5aab1f1..07559e0 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "857445edf4547c968bb438b2f705ab3b", + "content-hash": "8425ba8fa8c3256af1097d721de637ad", "packages": [ { "name": "brick/math", @@ -603,6 +603,73 @@ }, "time": "2024-03-19T20:07:36+00:00" }, + { + "name": "illuminate/filesystem", + "version": "v11.1.1", + "source": { + "type": "git", + "url": "https://github.com/illuminate/filesystem.git", + "reference": "5467e5c884a78847321926c748294c06f191027f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/filesystem/zipball/5467e5c884a78847321926c748294c06f191027f", + "reference": "5467e5c884a78847321926c748294c06f191027f", + "shasum": "" + }, + "require": { + "illuminate/collections": "^11.0", + "illuminate/contracts": "^11.0", + "illuminate/macroable": "^11.0", + "illuminate/support": "^11.0", + "php": "^8.2", + "symfony/finder": "^7.0" + }, + "suggest": { + "ext-fileinfo": "Required to use the Filesystem class.", + "ext-ftp": "Required to use the Flysystem FTP driver.", + "ext-hash": "Required to use the Filesystem class.", + "illuminate/http": "Required for handling uploaded files (^7.0).", + "league/flysystem": "Required to use the Flysystem local driver (^3.0.16).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^3.0).", + "league/flysystem-ftp": "Required to use the Flysystem FTP driver (^3.0).", + "league/flysystem-sftp-v3": "Required to use the Flysystem SFTP driver (^3.0).", + "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", + "symfony/filesystem": "Required to enable support for relative symbolic links (^7.0).", + "symfony/mime": "Required to enable support for guessing extensions (^7.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "11.x-dev" + } + }, + "autoload": { + "files": [ + "functions.php" + ], + "psr-4": { + "Illuminate\\Filesystem\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Filesystem package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2024-03-12T11:29:47+00:00" + }, { "name": "illuminate/macroable", "version": "v11.0.8", @@ -1157,6 +1224,70 @@ ], "time": "2024-03-02T12:46:12+00:00" }, + { + "name": "symfony/finder", + "version": "v7.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "6e5688d69f7cfc4ed4a511e96007e06c2d34ce56" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/6e5688d69f7cfc4ed4a511e96007e06c2d34ce56", + "reference": "6e5688d69f7cfc4ed4a511e96007e06c2d34ce56", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "symfony/filesystem": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v7.0.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": "2023-10-31T17:59:56+00:00" + }, { "name": "symfony/polyfill-ctype", "version": "v1.29.0", diff --git a/console.php b/console.php index 947cf2e..34ef2d2 100755 --- a/console.php +++ b/console.php @@ -1,6 +1,7 @@ create("some", "migrations", "my"); +////} catch (Exception $e) { +//// var_dump($e->getMessage()); +////} +//$rep = new \Illuminate\Database\Migrations\DatabaseMigrationRepository(); +//$migrator = new \Illuminate\Database\Migrations\Migrator() + +//UserMigration::up(); +//\itguild\forms\migrations\FormsMigration::up(); +//\itguild\forms\migrations\InputsTypeMigration::up(); +//\itguild\forms\migrations\FormsInputMigration::up(); +//\itguild\forms\migrations\FormsResMigration::up(); +//\itguild\forms\migrations\InputsValueMigrations::up(); +DB::forms('form_input')-> get(); diff --git a/index.php b/index.php index df005d7..104dccd 100755 --- a/index.php +++ b/index.php @@ -18,6 +18,11 @@ $router->get('/', [\itguild\forms\app\controllers\MainController::class, 'indexA $router->get('/example', [\itguild\forms\app\controllers\MainController::class, 'exampleAction']); $router->get('/create-user', [\itguild\forms\app\controllers\UserController::class, 'createUserAction']); $router->get('/get-user/{id}', [\itguild\forms\app\controllers\UserController::class, 'getUserAction']); +$router->get("/form/{id}", [\itguild\forms\app\controllers\FormController::class, "indexAction"]); +$router->get("/form-input/{id}", [\itguild\forms\app\controllers\FormInputController::class, "indexAction"]); +$router->get("/form-res/{id}", [\itguild\forms\app\controllers\FormResController::class, "indexAction"]); +$router->get("/input-type/{id}", [\itguild\forms\app\controllers\InputTypeController::class, "indexAction"]); +$router->get("/input-value/{id}", [\itguild\forms\app\controllers\InputValueController::class, "indexAction"]); $dispatcher = new Phroute\Phroute\Dispatcher($router->getData()); $response = $dispatcher->dispatch($_SERVER['REQUEST_METHOD'], parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); diff --git a/src/app/controllers/FormController.php b/src/app/controllers/FormController.php new file mode 100644 index 0000000..3338f51 --- /dev/null +++ b/src/app/controllers/FormController.php @@ -0,0 +1,26 @@ +fields; + Debug::dd($fields); + + } + public function createFormAction() + { + $form = Form::Create([ 'title' => "dsds", 'status' => 1, 'params' => "", ]); + } + +} \ No newline at end of file diff --git a/src/app/controllers/FormInputController.php b/src/app/controllers/FormInputController.php new file mode 100644 index 0000000..ef7e02f --- /dev/null +++ b/src/app/controllers/FormInputController.php @@ -0,0 +1,16 @@ +first()); + + } + +} \ No newline at end of file diff --git a/src/app/controllers/FormResController.php b/src/app/controllers/FormResController.php new file mode 100644 index 0000000..f94c1f8 --- /dev/null +++ b/src/app/controllers/FormResController.php @@ -0,0 +1,16 @@ +first()); + + } + +} \ No newline at end of file diff --git a/src/app/controllers/InputTypeController.php b/src/app/controllers/InputTypeController.php new file mode 100644 index 0000000..bd114f5 --- /dev/null +++ b/src/app/controllers/InputTypeController.php @@ -0,0 +1,16 @@ +first()); + + } + +} \ No newline at end of file diff --git a/src/app/controllers/InputValueController.php b/src/app/controllers/InputValueController.php new file mode 100644 index 0000000..a0c8dab --- /dev/null +++ b/src/app/controllers/InputValueController.php @@ -0,0 +1,16 @@ +first()); + + } + +} \ No newline at end of file diff --git a/src/app/models/FormInputModel.php b/src/app/models/FormInputModel.php new file mode 100644 index 0000000..4c9c5d0 --- /dev/null +++ b/src/app/models/FormInputModel.php @@ -0,0 +1,23 @@ +hasOne(InputTypeModel::class, "id"); + } +} \ No newline at end of file diff --git a/src/app/models/FormModel.php b/src/app/models/FormModel.php new file mode 100644 index 0000000..e444f8e --- /dev/null +++ b/src/app/models/FormModel.php @@ -0,0 +1,23 @@ +hasMany(FormInputModel::class, "form_id"); + } +} \ No newline at end of file diff --git a/src/app/models/FormResModel.php b/src/app/models/FormResModel.php new file mode 100644 index 0000000..1010043 --- /dev/null +++ b/src/app/models/FormResModel.php @@ -0,0 +1,18 @@ +create("form_input", function (Blueprint $table) { + $table->id("id"); + $table->unsignedBigInteger('form_id'); + $table->unsignedBigInteger('input_type_id'); + $table->text('params'); + $table->timestamps(); + + $table->index('form_id'); + $table->index('input_type_id'); + $table->foreign('form_id', 'fk_form_input_form')->references('id')->on('form'); + $table->foreign('input_type_id', 'fk_form_input_input_type')->references('id')->on('input_type'); + }); + + } + + public static function down(): void + { + Illuminate\Database\Capsule\Manager::schema()->drop("form_input"); + } + +} \ No newline at end of file diff --git a/src/migrations/FormsMigration.php b/src/migrations/FormsMigration.php new file mode 100644 index 0000000..6778a37 --- /dev/null +++ b/src/migrations/FormsMigration.php @@ -0,0 +1,31 @@ +create("form", function ($table) { + $table->id('id'); + $table->string('title'); + $table->integer('status'); + $table->text('params')->nullable(); + $table->timestamps(); + }); + + } + public static function get() + { + return DB::forms('form_input')-> get(); + } + + public static function down(): void + { + Illuminate\Database\Capsule\Manager::schema()->drop("form"); + } + +} \ No newline at end of file diff --git a/src/migrations/FormsResMigration.php b/src/migrations/FormsResMigration.php new file mode 100644 index 0000000..85e616e --- /dev/null +++ b/src/migrations/FormsResMigration.php @@ -0,0 +1,28 @@ +create("form_res", function ($table) { + $table->id('id'); + $table->unsignedBigInteger('form_id'); + $table->json('data'); + $table->timestamps(); + + $table->foreign('form_id', 'fk_form_form')->references('id')->on('form'); + }); + + } + + public static function down(): void + { + Illuminate\Database\Capsule\Manager::schema()->drop("form_res"); + } + +} \ No newline at end of file diff --git a/src/migrations/InputsTypeMigration.php b/src/migrations/InputsTypeMigration.php new file mode 100644 index 0000000..57815bf --- /dev/null +++ b/src/migrations/InputsTypeMigration.php @@ -0,0 +1,25 @@ +create("input_type", function ($table) { + $table->id('id'); + $table->string('type'); + $table->string('name'); + $table->integer('status'); + }); + + } + + public static function down(): void + { + Illuminate\Database\Capsule\Manager::schema()->drop("input_type"); + } + +} \ No newline at end of file diff --git a/src/migrations/InputsValueMigrations.php b/src/migrations/InputsValueMigrations.php new file mode 100644 index 0000000..c14e24c --- /dev/null +++ b/src/migrations/InputsValueMigrations.php @@ -0,0 +1,28 @@ +create("input_value", function ($table) { + $table->id('id'); + $table->unsignedBigInteger('form_input_id'); + $table->string('value'); + $table->timestamps(); + + $table->foreign('form_input_id', 'fk_form_input')->references('id')->on('form_input'); + }); + + } + + public static function down(): void + { + Illuminate\Database\Capsule\Manager::schema()->drop("input_value"); + } + +} \ No newline at end of file