File "2016_10_01_091807_create_profiles_table.php"

Full path: /home/qooetu/costes.qooetu.com/database/migrations/2016_10_01_091807_create_profiles_table.php
File size: 1.52 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor &nnbsp; Back

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProfilesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('profiles', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->unsigned();
            $table->enum('gender',['Male','Female'])->nullable();
            $table->date('dob')->nullable();
            $table->string('telephone')->nullable();
            $table->string('country')->nullable();
            $table->string('postal_address')->nullable();
            $table->string('city')->nullable();
            $table->string('id_number')->nullable();
            $table->string('timezone')->nullable();
            $table->enum('status',['Compelete','Incomplete'])->default('Incomplete');
            $table->timestamps();
             $table->softDeletes();
            $table->foreign('user_id')->references('id')->on('users')
                ->onUpdate('cascade')->onDelete('cascade');
        });

         DB::table('profiles')->insert([
            'user_id' => 1,
            'created_at'=>date('Y-m-d H:i:s'),
            'updated_at'=>date('Y-m-d H:i:s'),
           ]);
    }

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