Total Complexity | 2 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
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'); |
||
52 |