|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Support\Facades\Schema; |
|
4
|
|
|
use Illuminate\Database\Schema\Blueprint; |
|
5
|
|
|
use Illuminate\Database\Migrations\Migration; |
|
6
|
|
|
|
|
7
|
|
|
class CreatepagesTable extends Migration |
|
8
|
|
|
{ |
|
9
|
|
|
public function up() |
|
10
|
|
|
{ |
|
11
|
|
|
Schema::create('pages', function (Blueprint $table) { |
|
12
|
|
|
$table->increments('id'); |
|
13
|
|
|
$table->string('collection', 32)->index()->default('singles'); |
|
14
|
|
|
$table->boolean('published')->default(false); |
|
15
|
|
|
$table->boolean('featured')->default(false); |
|
16
|
|
|
$table->timestamp('archived_at')->default(null)->nullable(); |
|
17
|
|
|
$table->boolean('hidden_in_menu')->default(false); |
|
18
|
|
|
$table->timestamp('publication')->nullable(); |
|
19
|
|
|
$table->timestamp('start_at')->nullable(); |
|
20
|
|
|
$table->timestamp('end_at')->nullable(); |
|
21
|
|
|
$table->timestamps(); |
|
22
|
|
|
$table->softDeletes(); |
|
23
|
|
|
}); |
|
24
|
|
|
|
|
25
|
|
|
Schema::create('page_translations', function (Blueprint $table) { |
|
26
|
|
|
$table->increments('id'); |
|
27
|
|
|
$table->integer('page_id')->unsigned(); |
|
28
|
|
|
$table->string('locale'); |
|
29
|
|
|
$table->string('slug')->unique(); |
|
30
|
|
|
$table->string('title'); |
|
31
|
|
|
$table->text('content')->nullable(); |
|
32
|
|
|
$table->text('short')->nullable(); |
|
33
|
|
|
$table->string('seo_title')->nullable(); |
|
34
|
|
|
$table->text('seo_description')->nullable(); |
|
35
|
|
|
$table->timestamps(); |
|
36
|
|
|
|
|
37
|
|
|
$table->foreign('page_id')->references('id')->on('pages')->onDelete('cascade'); |
|
38
|
|
|
}); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function down() |
|
42
|
|
|
{ |
|
43
|
|
|
Schema::dropIfExists('page_translations'); |
|
44
|
|
|
Schema::dropIfExists('pages'); |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
|