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