Completed
Branch master (2f299a)
by Ron
07:33
created

CreateUsersTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 20
c 0
b 0
f 0
dl 0
loc 40
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 3 1
A up() 0 22 1
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
use App\User;
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->boolean('active');
26
            $table->timestamps();
27
        });
28
        
29
        User::create([
30
            'user_id'    => 1,
31
            'username'   => 'admin',
32
            'first_name' => 'System',
33
            'last_name'  => 'Administrator',
34
            'email'      => '[email protected]',
35
            'password'   => bcrypt('password'),
36
            'active'     => 1
37
        ]);
38
    }
39
40
    /**
41
     * Reverse the migrations.
42
     *
43
     * @return void
44
     */
45
    public function down()
46
    {
47
        Schema::dropIfExists('users');
48
    }
49
}
50