Skip to content

Instantly share code, notes, and snippets.

@cursosdesarrolloweb
Last active July 14, 2021 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cursosdesarrolloweb/3a157c7e0937227cfbc997cdec77d7f5 to your computer and use it in GitHub Desktop.
Save cursosdesarrolloweb/3a157c7e0937227cfbc997cdec77d7f5 to your computer and use it in GitHub Desktop.
<?php
use App\Enums\UserType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Models\User;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->enum("role", UserType::getValues())->default(UserType::Moderator());
$table->string('name');
$table->string('phone')->nullable();
$table->string('email')->unique()->nullable();
$table->timestamp('email_verified_at')->nullable();
$table->string('password')->nullable();
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment