first commit
This commit is contained in:
36
migrations/FormsInputMigration.php
Normal file
36
migrations/FormsInputMigration.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\form\migrations;
|
||||
use Illuminate;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class FormsInputMigration extends Illuminate\Database\Migrations\Migration
|
||||
{
|
||||
|
||||
public static function up(): void
|
||||
{
|
||||
|
||||
Illuminate\Database\Capsule\Manager::schema()->create("form_input", function (Blueprint $table) {
|
||||
$table->id("id");
|
||||
$table->unsignedBigInteger('form_id');
|
||||
$table->unsignedBigInteger('input_type_id');
|
||||
$table->string('label');
|
||||
$table->string('name');
|
||||
$table->text('params');
|
||||
$table->integer(11)->default(1);
|
||||
$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");
|
||||
}
|
||||
|
||||
}
|
32
migrations/FormsMigration.php
Normal file
32
migrations/FormsMigration.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\form\migrations;
|
||||
use Illuminate;
|
||||
use itguild\forms\migrations\DB;
|
||||
|
||||
class FormsMigration
|
||||
{
|
||||
|
||||
public static function up(): void
|
||||
{
|
||||
|
||||
Illuminate\Database\Capsule\Manager::schema()->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");
|
||||
}
|
||||
|
||||
}
|
28
migrations/FormsResMigration.php
Normal file
28
migrations/FormsResMigration.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\form\migrations;
|
||||
use Illuminate;
|
||||
|
||||
class FormsResMigration
|
||||
{
|
||||
|
||||
public static function up(): void
|
||||
{
|
||||
|
||||
Illuminate\Database\Capsule\Manager::schema()->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");
|
||||
}
|
||||
|
||||
}
|
25
migrations/InputsTypeMigration.php
Normal file
25
migrations/InputsTypeMigration.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\form\migrations;
|
||||
use Illuminate;
|
||||
|
||||
class InputsTypeMigration
|
||||
{
|
||||
public static function up(): void
|
||||
{
|
||||
|
||||
Illuminate\Database\Capsule\Manager::schema()->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");
|
||||
}
|
||||
|
||||
}
|
28
migrations/InputsValueMigrations.php
Normal file
28
migrations/InputsValueMigrations.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\form\migrations;
|
||||
use Illuminate;
|
||||
|
||||
class InputsValueMigrations
|
||||
{
|
||||
|
||||
public static function up(): void
|
||||
{
|
||||
|
||||
Illuminate\Database\Capsule\Manager::schema()->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");
|
||||
}
|
||||
|
||||
}
|
30
migrations/UserMigration.php
Executable file
30
migrations/UserMigration.php
Executable file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\form\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");
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user