<?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()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('password');

            $table->boolean('confirmed')->default(false);
            $table->string('confirmation_code', 30)->index()->nullable();
            $table->timestamp('confirmation_date')->nullable();
            $table->dateTime('confirmation_code_to')->nullable();
            $table->unsignedTinyInteger('confirmation_code_remider')->default(0);

            $table->boolean('active')->default(false);
            $table->timestamp('active_date')->nullable();

            $table->dateTime('agreement')->nullable();

            $table->boolean('admin')->default(false);

            $table->string('identify');

            $table->char('lang', 2)->index();

            $table->rememberToken();

            $table->timestamp('last_login')->nullable();

            $table->timestamps();

            $table->softDeletes();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
