2014_10_12_000000_create_users_table.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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->string('email')->unique();
  21. $table->timestamp('email_verified_at')->nullable();
  22. $table->string('password');
  23. $table->rememberToken();
  24. $table->timestamps();
  25. });
  26. DB::table('users')->insert([
  27. 'name' => 'admin',
  28. 'email' => 'admin@example.com',
  29. 'password' => Hash::make('12345678'),
  30. 'isAdmin' => true
  31. ]);
  32. }
  33. /**
  34. * Reverse the migrations.
  35. *
  36. * @return void
  37. */
  38. public function down()
  39. {
  40. Schema::dropIfExists('users');
  41. }
  42. }