Passed
Push — dev5 ( b08d9a...c43caf )
by Ron
04:08
created

CreateSettingsTable::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 16
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 21
rs 9.7333
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateSettingsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('settings', function(Blueprint $table) {
17
            $table->increments('id');
18
            $table->text('key');
19
            $table->text('value');
20
            $table->timestamps();
21
        });
22
        
23
        //  Insert default settings
24
        DB::table('settings')->insert([
25
            ['created_at' => \Carbon\Carbon::now(), 'key' => 'app.logo', 'value' => config('app.logo')],
26
            ['created_at' => \Carbon\Carbon::now(), 'key' => 'app.timezone', 'value' => config('app.timezone')],
27
            ['created_at' => \Carbon\Carbon::now(), 'key' => 'mail.host', 'value' => config('mail.host')],
28
            ['created_at' => \Carbon\Carbon::now(), 'key' => 'mail.port', 'value' => config('mail.port')],
29
            ['created_at' => \Carbon\Carbon::now(), 'key' => 'mail.encryption', 'value' => config('mail.encryption')],
30
            ['created_at' => \Carbon\Carbon::now(), 'key' => 'mail.username', 'value' => config('mail.username')],
31
            ['created_at' => \Carbon\Carbon::now(), 'key' => 'mail.password', 'value' => config('mail.password')],
32
            ['created_at' => \Carbon\Carbon::now(), 'key' => 'mail.from.address', 'value' => config('mail.from.address')],
33
            ['created_at' => \Carbon\Carbon::now(), 'key' => 'mail.from.name', 'value' => config('mail.from.name')],
34
            ['created_at' => \Carbon\Carbon::now(), 'key' => 'user.passExpires', 'value' => 30],
35
        ]);
36
    }
37
38
    /**
39
     * Reverse the migrations.
40
     *
41
     * @return void
42
     */
43
    public function down()
44
    {
45
        Schema::dropIfExists('settings');
46
    }
47
}
48