2014_10_12_000000_create_users_table.php 1012 B

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