Skip to content

Instantly share code, notes, and snippets.

@fearrr
Created April 27, 2017 11:00
Show Gist options
  • Select an option

  • Save fearrr/ed3dc04d260da9e2e7a8189bd73c604d to your computer and use it in GitHub Desktop.

Select an option

Save fearrr/ed3dc04d260da9e2e7a8189bd73c604d to your computer and use it in GitHub Desktop.

Revisions

  1. fearrr created this gist Apr 27, 2017.
    35 changes: 35 additions & 0 deletions migration.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    <?php

    public function up()
    {
    Schema::create('categories', function (Blueprint $table){

    $table->increments('id');
    $table->string('slug')->nullable();
    $table->string('old_redirect')->nullable();
    $table->string('name')->nullable();
    $table->string('short_desc')->nullable();
    $table->text('full_desc')->nullable();
    $table->string('img_sm')->nullable();
    $table->string('img_md')->nullable();
    $table->string('img_lg')->nullable();
    $table->unsignedTinyInteger('priority');
    $table->unsignedTinyInteger('type');
    $table->boolean('active')->default(true);
    $table->timestamps();

    NestedSet::columns($table);

    $table->unique(['parent_id', 'slug']);

    });

    }

    public function down()
    {
    Schema::table('categories', function (Blueprint $table) {
    NestedSet::dropColumns($table);
    });
    Schema::dropIfExists('categories');
    }