CreateLangSwitcherTable   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 15
c 2
b 0
f 0
dl 0
loc 35
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 4 1
A up() 0 15 2
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
/**
8
 * Migration auto-generated by Sequel Pro Laravel Export (1.5.0).
9
 *
10
 * @see https://github.com/cviebrock/sequel-pro-laravel-export
11
 */
12
class CreateLangSwitcherTable extends Migration
13
{
14
    /**
15
     * Run the migrations.
16
     *
17
     * @return void
18
     */
19
    public function up()
20
    {
21
        $connection=config('lang-switch.database.connection');
22
        if (!Schema::connection($connection)->hasTable('_lang_switcher')) {
23
            Schema::connection($connection)->create('_lang_switcher', function (Blueprint $table) {
24
                $table->increments('id');
25
                $table->string('class', 20)->default('');
26
                $table->string('method', 20)->default('');
27
                $table->string('middleware', 20)->default('');
28
                $table->tinyInteger('enable')->default(1);
29
30
                $table->index('class', 'class');
31
                $table->index('method', 'method');
32
                $table->index('middleware', 'middleware');
33
                $table->index('enable', 'enable');
34
            });
35
        }
36
    }
37
38
    /**
39
     * Reverse the migrations.
40
     *
41
     * @return void
42
     */
43
    public function down()
44
    {
45
        $connection=config('lang-switch.database.connection');
46
        Schema::connection($connection)->dropIfExists('_lang_switcher');
47
    }
48
}
49