2014_10_12_000000_create_users_table.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Hash;
  5. use Illuminate\Support\Facades\Schema;
  6. class CreateUsersTable extends Migration
  7. {
  8. /**
  9. * Run the migrations.
  10. *
  11. * @return void
  12. */
  13. public function up()
  14. {
  15. Schema::create('users', function (Blueprint $table) {
  16. $table->id();
  17. $table->string('name');
  18. $table->boolean('isAdmin')->default(false);
  19. $table->boolean('isEnabled')->default(true);
  20. $table->bigInteger('numLogin')->default(0);
  21. $table->string('email')->unique();
  22. $table->timestamp('email_verified_at')->nullable();
  23. $table->string('password');
  24. $table->rememberToken();
  25. $table->timestamps();
  26. });
  27. DB::table('users')->insert([
  28. 'name' => 'admin',
  29. 'email' => 'admin@example.com',
  30. 'password' => Hash::make('12345678'),
  31. 'isAdmin' => true
  32. ]);
  33. }
  34. /**
  35. * Reverse the migrations.
  36. *
  37. * @return void
  38. */
  39. public function down()
  40. {
  41. Schema::dropIfExists('users');
  42. }
  43. }