/home/mip/mip/database/migrations/likod/2016_05_04_013101_create_modules_table.php
<?php

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

class CreateModulesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('modules', function (Blueprint $table) {
            $table->engine = 'MYISAM';
            $table->increments('id');
            $table->string('title', 100);
            $table->string('link_type', 20)->default('Parent');
            $table->integer('page_id')->unsigned()->index()->default('0');
            $table->string('module_name', 50);
            $table->string('module_description', 255);
            $table->string('url', 255)->default('');
            $table->string('uri', 255)->default('');
            $table->string('icon', 50)->default('');
            $table->integer('menu_group_id')->unsigned()->index();
            $table->integer('position')->unsigned()->index()->default('0');
            $table->string('target', 10)->default('');
            $table->integer('parent_id')->unsigned()->index();
            $table->tinyInteger('is_parent')->unsigned()->index();
            $table->tinyInteger('has_parent')->unsigned()->index();
            $table->enum('show_menu', ['0', '1'])->default('1');
            $table->tinyInteger('has_read')->unsigned()->index();
            $table->tinyInteger('has_create')->unsigned()->index();
            $table->tinyInteger('has_update')->unsigned()->index();
            $table->tinyInteger('has_delete')->unsigned()->index();
            $table->tinyInteger('has_export')->unsigned()->index();
            $table->tinyInteger('has_import')->unsigned()->index();
            $table->tinyInteger('has_print')->unsigned()->index();
            $table->timestamps();
        });
        DB::table('modules')->insert([
            [
                'id' => 1,
                'title' => 'Settings',
                'link_type' => 'Parent',
                'module_name' => 'Settings',
                'module_description' => 'Settings',
                'url' => '#',
                'icon' => 'cogs',
                'menu_group_id' => 1,
                'parent_id' => 0,
                'is_parent' => 1,
                'has_parent' => 0,
                'show_menu' => 1,
                'has_read' => 0,
                'has_create' => 0,
                'has_update' => 0,
                'has_delete' => 0,
                'has_export' => 0,
                'has_import' => 0,
                'has_print' => 0,
                'created_at' => new \Carbon\Carbon,
                'updated_at' => new \Carbon\Carbon
            ],
            [
                'id' => 2,
                'title' => 'Role Manager',
                'link_type' => 'Child',
                'module_name' => 'Role Manager',
                'module_description' => 'Role Manager',
                'url' => 'settings/roles',
                'icon' => 'ban',
                'menu_group_id' => 1,
                'parent_id' => 1,
                'is_parent' => 0,
                'has_parent' => 1,
                'show_menu' => 1,
                'has_read' => 1,
                'has_create' => 1,
                'has_update' => 1,
                'has_delete' => 1,
                'has_export' => 0,
                'has_import' => 0,
                'has_print' => 0,
                'created_at' => new \Carbon\Carbon,
                'updated_at' => new \Carbon\Carbon
            ],
            [
                'id' => 3,
                'title' => 'User Manager',
                'link_type' => 'Child',
                'module_name' => 'User Manager',
                'module_description' => 'User Manager',
                'url' => 'settings/users',
                'icon' => 'users',
                'menu_group_id' => 1,
                'parent_id' => 1,
                'is_parent' => 0,
                'has_parent' => 1,
                'show_menu' => 1,
                'has_read' => 1,
                'has_create' => 1,
                'has_update' => 1,
                'has_delete' => 1,
                'has_export' => 0,
                'has_import' => 0,
                'has_print' => 0,
                'created_at' => new \Carbon\Carbon,
                'updated_at' => new \Carbon\Carbon
            ],
            [
                'id' => 4,
                'title' => 'Clients',
                'link_type' => 'Parent',
                'module_name' => 'Clients',
                'module_description' => 'Clients',
                'url' => '#',
                'icon' => 'building',
                'menu_group_id' => 1,
                'parent_id' => 0,
                'is_parent' => 1,
                'has_parent' => 0,
                'show_menu' => 1,
                'has_read' => 0,
                'has_create' => 0,
                'has_update' => 0,
                'has_delete' => 0,
                'has_export' => 0,
                'has_import' => 0,
                'has_print' => 0,
                'created_at' => new \Carbon\Carbon,
                'updated_at' => new \Carbon\Carbon
            ],
            [
                'id' => 5,
                'title' => 'Client Directories',
                'link_type' => 'Child',
                'module_name' => 'Client Directories',
                'module_description' => 'Client Directories',
                'url' => 'clients/client-directories',
                'icon' => 'book',
                'menu_group_id' => 1,
                'parent_id' => 4,
                'is_parent' => 0,
                'has_parent' => 1,
                'show_menu' => 1,
                'has_read' => 1,
                'has_create' => 1,
                'has_update' => 1,
                'has_delete' => 1,
                'has_export' => 0,
                'has_import' => 0,
                'has_print' => 0,
                'created_at' => new \Carbon\Carbon,
                'updated_at' => new \Carbon\Carbon
            ],
        ]);
    }

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