1
|
|
|
<?php |
2
|
|
|
use Illuminate\Support\Facades\Schema; |
3
|
|
|
use Illuminate\Database\Schema\Blueprint; |
4
|
|
|
use Illuminate\Database\Migrations\Migration; |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* Class CreateSubmodulesTable. |
8
|
|
|
* |
9
|
|
|
*/ |
10
|
|
|
class CreateSubmodulesTable extends Migration |
|
|
|
|
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* Run the migrations. |
14
|
|
|
* |
15
|
|
|
* @return void |
16
|
|
|
*/ |
17
|
|
|
public function up() |
18
|
|
|
{ |
19
|
|
|
Schema::create('submodules', function (Blueprint $table) { |
|
|
|
|
20
|
|
|
$table->increments('id'); |
21
|
|
|
$table->string('name'); |
22
|
|
|
$table->boolean('selected')->nullable(); |
23
|
|
|
$table->unsignedTinyInteger('order')->nullable(); |
24
|
|
|
$table->integer('type')->unsigned()->default(1); |
25
|
|
|
$table->integer('total_hours')->nullable(); |
26
|
|
|
$table->integer('week_hours')->nullable(); |
27
|
|
|
$table->integer('module_id')->unsigned(); |
28
|
|
|
$table->date('start_date')->nullable(); |
29
|
|
|
$table->date('end_date')->nullable(); |
30
|
|
|
$table->timestamps(); |
31
|
|
|
}); |
32
|
|
|
Schema::create('module_submodule', function (Blueprint $table) { |
|
|
|
|
33
|
|
|
$table->integer('module_id')->unsigned(); |
34
|
|
|
$table->integer('submodule_id')->unsigned(); |
35
|
|
|
$table->timestamps(); |
36
|
|
|
}); |
37
|
|
|
Schema::create('classroom_submodule', function (Blueprint $table) { |
|
|
|
|
38
|
|
|
$table->integer('classroom_id')->unsigned(); |
39
|
|
|
$table->integer('submodule_id')->unsigned(); |
40
|
|
|
$table->timestamps(); |
41
|
|
|
}); |
42
|
|
|
Schema::create('course_submodule', function (Blueprint $table) { |
|
|
|
|
43
|
|
|
$table->integer('course_id')->unsigned(); |
44
|
|
|
$table->integer('submodule_id')->unsigned(); |
45
|
|
|
$table->timestamps(); |
46
|
|
|
}); |
47
|
|
|
} |
48
|
|
|
/** |
49
|
|
|
* Reverse the migrations. |
50
|
|
|
* |
51
|
|
|
* @return void |
52
|
|
|
*/ |
53
|
|
|
public function down() |
54
|
|
|
{ |
55
|
|
|
Schema::dropIfExists('submodules'); |
56
|
|
|
Schema::dropIfExists('module_submodule'); |
57
|
|
|
Schema::dropIfExists('classroom_submodule'); |
58
|
|
|
Schema::dropIfExists('course_submodule'); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|
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.