2022_02_22_031727_create_users_table.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class 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->string('phone')->unique();
  18. $table->string('email')->unique();
  19. $table->boolean('status')->default(true); // true(active) false(not active)
  20. $table->timestamp('email_verified_at')->nullable();
  21. $table->string('password')->default(bcrypt('12345678'));
  22. $table->enum('gender_id', [1, 2]); // 1(female) 2(male)
  23. $table->foreignId('role_id')->constrained();
  24. $table->foreignId('outlet_id')->nullable()->default(null)->constrained();
  25. $table->rememberToken();
  26. $table->timestamps();
  27. });
  28. }
  29. /**
  30. * Reverse the migrations.
  31. *
  32. * @return void
  33. */
  34. public function down()
  35. {
  36. Schema::dropIfExists('users');
  37. }
  38. };