Skip to content

Instantly share code, notes, and snippets.

@fearrr
Created April 27, 2017 11:00
Show Gist options
  • Save fearrr/ed3dc04d260da9e2e7a8189bd73c604d to your computer and use it in GitHub Desktop.
Save fearrr/ed3dc04d260da9e2e7a8189bd73c604d to your computer and use it in GitHub Desktop.
<?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');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment