Passed
Push — master ( 2a90e7...a622eb )
by Ron
02:27 queued 14s
created

CreateUsersTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 20
c 1
b 0
f 0
dl 0
loc 41
rs 10
wmc 2
1
<?php
2
3
use App\User;
4
use Illuminate\Support\Facades\Schema;
5
use Illuminate\Database\Schema\Blueprint;
6
use Illuminate\Database\Migrations\Migration;
7
8
class CreateUsersTable extends Migration
9
{
10
    /**
11
     * Run the migrations.
12
     *
13
     * @return void
14
     */
15
    public function up()
16
    {
17
        Schema::create('users', function(Blueprint $table) {
18
            $table->increments('user_id');
19
            $table->string('username')->unique;
20
            $table->string('first_name');
21
            $table->string('last_name');
22
            $table->string('email')->unique();
23
            $table->string('password');
24
            $table->rememberToken();
25
            $table->timestamp('password_expires')->nullable();
26
            $table->softDeletes();
27
            $table->timestamps();
28
        });
29
30
        //  Create the initial default user
31
        User::create([
32
            'user_id'      => 1,
33
            'username'     => 'admin',
34
            'first_name'   => 'System',
35
            'last_name'    => 'Administrator',
36
            'email'        => '[email protected]',
37
            'password'     => bcrypt('password'),
38
            'password_expires' => '2000-01-01 00:00:00',
39
        ]);
40
    }
41
42
    /**
43
     * Reverse the migrations.
44
     *
45
     * @return void
46
     */
47
    public function down()
48
    {
49
        Schema::dropIfExists('users');
50
    }
51
}
52