1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Illuminate\Database\Migrations\Migration; |
4
|
|
|
use \jlourenco\base\Database\Blueprint; |
5
|
|
|
|
6
|
|
|
class CreateBaseTables extends Migration |
|
|
|
|
7
|
|
|
{ |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Run the migrations. |
11
|
|
|
* |
12
|
|
|
* @return void |
13
|
|
|
*/ |
14
|
|
|
public function up() |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
Schema::create('User', function (Blueprint $table) { |
18
|
|
|
$table->increments('id'); |
19
|
|
|
$table->string('username', 25)->nullable()->unique(); |
20
|
|
|
$table->string('password', 60)->nullable(); |
21
|
|
|
$table->string('first_name', 25); |
22
|
|
|
$table->string('last_name', 25); |
23
|
|
|
$table->string('email')->unique(); |
24
|
|
|
$table->text('description')->nullable(); |
25
|
|
|
$table->timestamp('birthday')->nullable(); |
26
|
|
|
$table->tinyInteger('status'); |
27
|
|
|
$table->string('ip', 15); |
28
|
|
|
$table->binary('staff'); |
29
|
|
|
$table->timestamp('last_login')->nullable(); |
30
|
|
|
$table->text('permissions')->nullable(); |
31
|
|
|
$table->rememberToken(); |
32
|
|
|
$table->timestamps(); |
33
|
|
|
$table->softDeletes(); |
34
|
|
|
$table->creation(); |
35
|
|
|
}); |
36
|
|
|
|
37
|
|
|
Schema::create('Logs', function (Blueprint $table) { |
38
|
|
|
$table->increments('id'); |
39
|
|
|
$table->text('log'); |
40
|
|
|
$table->timestamps(); |
41
|
|
|
$table->creation(); |
42
|
|
|
}); |
43
|
|
|
|
44
|
|
|
Schema::create('Settings', function (Blueprint $table) { |
45
|
|
|
$table->increments('id'); |
46
|
|
|
$table->string('friendy_name', 25); |
47
|
|
|
$table->string('name', 25); |
48
|
|
|
$table->string('vale', 150)->nullable(); |
49
|
|
|
$table->string('description', 250)->nullable(); |
50
|
|
|
$table->creation(); |
51
|
|
|
}); |
52
|
|
|
|
53
|
|
View Code Duplication |
Schema::create('Group', function (Blueprint $table) { |
|
|
|
|
54
|
|
|
$table->increments('id'); |
55
|
|
|
$table->string('name', 25); |
56
|
|
|
$table->string('description', 250)->nullable(); |
57
|
|
|
$table->string('slug', 250); |
58
|
|
|
$table->text('permissions')->nullable(); |
59
|
|
|
|
60
|
|
|
$table->timestamps(); |
61
|
|
|
$table->softDeletes(); |
62
|
|
|
$table->creation(); |
63
|
|
|
$table->unique('slug'); |
64
|
|
|
}); |
65
|
|
|
|
66
|
|
|
Schema::create('Group_User', function (Blueprint $table) { |
67
|
|
|
$table->increments('id'); |
68
|
|
|
$table->integer('user')->unsigned(); |
69
|
|
|
$table->integer('group')->unsigned(); |
70
|
|
|
|
71
|
|
|
$table->nullableTimestamps(); |
72
|
|
|
$table->creation(); |
73
|
|
|
|
74
|
|
|
$table->foreign('user')->references('id')->on('User'); |
75
|
|
|
$table->foreign('group')->references('id')->on('Group'); |
76
|
|
|
}); |
77
|
|
|
|
78
|
|
View Code Duplication |
Schema::create('ActivityFeed', function (Blueprint $table) { |
|
|
|
|
79
|
|
|
$table->increments('id'); |
80
|
|
|
$table->string('added_by', 150); |
81
|
|
|
$table->text('activity'); |
82
|
|
|
$table->string('icon', 100); |
83
|
|
|
$table->timestamp('visibility'); |
84
|
|
|
$table->string('link', 250)->nullable(); |
85
|
|
|
$table->text('requirements')->nullable(); |
86
|
|
|
$table->timestamps(); |
87
|
|
|
}); |
88
|
|
|
|
89
|
|
|
Schema::create('Permission', function (Blueprint $table) { |
90
|
|
|
$table->increments('id'); |
91
|
|
|
$table->string('key', 100); |
92
|
|
|
$table->string('description', 250); |
93
|
|
|
|
94
|
|
|
$table->unique('key'); |
95
|
|
|
}); |
96
|
|
|
|
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Reverse the migrations. |
101
|
|
|
* |
102
|
|
|
* @return void |
103
|
|
|
*/ |
104
|
|
|
public function down() |
105
|
|
|
{ |
106
|
|
|
|
107
|
|
|
Schema::drop('Logs'); |
108
|
|
|
Schema::drop('Settings'); |
109
|
|
|
Schema::drop('Group_User'); |
110
|
|
|
Schema::drop('Group'); |
111
|
|
|
Schema::drop('ActivityFeed'); |
112
|
|
|
Schema::drop('Permission'); |
113
|
|
|
Schema::drop('User'); |
114
|
|
|
|
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
} |
118
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.