Conditions | 6 |
Paths | 1 |
Total Lines | 37 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function up() |
||
15 | { |
||
16 | $table_name = config('multi-tenant.table_name'); |
||
17 | |||
18 | Schema::create($table_name, function (Blueprint $table) use ($table_name) { |
||
19 | $table->increments('id'); |
||
20 | $table->integer('owner_id'); |
||
21 | $table->string('name'); |
||
22 | $table->string('slug')->unique(); |
||
23 | |||
24 | foreach(config('multi-tenant.additional_tenant_columns') as $key => $data) { |
||
25 | $type = $data['type']; |
||
26 | $column = $table->$type($key); |
||
27 | |||
28 | if ($data['index']) { |
||
29 | $column->index(); |
||
30 | } |
||
31 | |||
32 | if ($data['unique']) { |
||
33 | $column->unique(); |
||
34 | } |
||
35 | |||
36 | if ($data['unsigned']) { |
||
37 | $column->unsigned(); |
||
38 | } |
||
39 | |||
40 | if ($data['nullable']) { |
||
41 | $column->nullable(); |
||
42 | } |
||
43 | } |
||
44 | |||
45 | $table->timestamps(); |
||
46 | |||
47 | $table->index('owner_id', $table_name . '_owner_id_index'); |
||
48 | $table->index('slug', $table_name . '_slug_index'); |
||
49 | }); |
||
50 | } |
||
51 | |||
62 |
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.