for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddActiveTokenFieldToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
if (!Schema::hasColumn('users', 'token')) {
Schema::table('users', function (Blueprint $table) {
$table->string('token', 24)->unique()->after('remember_token');
});
}
if (!Schema::hasColumn('users', 'active')) {
$table->tinyInteger('active')->default(0)->after('token');
* Reverse the migrations.
public function down()
if (Schema::hasColumn('users', 'token')) {
$table->dropColumn('token');
if (Schema::hasColumn('users', 'active')) {
$table->dropColumn('active');