1 | <?php |
||
8 | class CreatePagesTable extends Migration |
||
9 | { |
||
10 | /** |
||
11 | * Run the migrations. |
||
12 | * |
||
13 | * @return void |
||
14 | */ |
||
15 | public function up(): void |
||
16 | { |
||
17 | Schema::create(config('rinvex.pages.tables.pages'), function (Blueprint $table) { |
||
18 | // Columns |
||
19 | $table->increments('id'); |
||
20 | $table->string('uri'); |
||
21 | $table->string('slug'); |
||
22 | $table->string('route'); |
||
23 | $table->string('domain')->nullable(); |
||
24 | $table->string('middleware')->nullable(); |
||
25 | $table->{$this->jsonable()}('title'); |
||
26 | $table->{$this->jsonable()}('subtitle')->nullable(); |
||
27 | $table->{$this->jsonable()}('excerpt')->nullable(); |
||
28 | $table->{$this->jsonable()}('content')->nullable(); |
||
29 | $table->string('view'); |
||
30 | $table->boolean('is_active')->default(true); |
||
31 | $table->mediumInteger('sort_order')->unsigned()->default(0); |
||
32 | $table->timestamps(); |
||
33 | $table->softDeletes(); |
||
34 | |||
35 | // Indexes |
||
36 | $table->unique(['domain', 'uri']); |
||
37 | $table->unique(['domain', 'slug']); |
||
38 | $table->unique(['domain', 'route']); |
||
39 | }); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Reverse the migrations. |
||
44 | * |
||
45 | * @return void |
||
46 | */ |
||
47 | public function down(): void |
||
48 | { |
||
49 | Schema::dropIfExists(config('rinvex.pages.tables.pages')); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Get jsonable column data type. |
||
54 | * |
||
55 | * @return string |
||
56 | */ |
||
57 | protected function jsonable(): string |
||
65 | } |
||
66 |