Skip to content

Instantly share code, notes, and snippets.

@nissicreative
Last active April 19, 2017 16:56
Show Gist options
  • Save nissicreative/b27c08768d144c0500b89fc29ad81ad7 to your computer and use it in GitHub Desktop.
Save nissicreative/b27c08768d144c0500b89fc29ad81ad7 to your computer and use it in GitHub Desktop.
Laravel Users Table Migration
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Account for existing users table.
if (Schema::hasTable('users')) {
return;
}
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('access_level')->default(10);
$table->string('first_name');
$table->string('last_name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
$table->softDeletes();
});
}
/**
* 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