vespakoen/menu

Databases table structure, please? Thanks.

Closed this issue · 2 comments

Databases table structure, please? Thanks.

I am using a translation package with this but ...

<?php

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


class CreateMenusTable extends Migration
{

    public function __construct()
    {
        // Get the prefix
        $this->prefix = Config::get('general.general_db.prefix', '');
    }


    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create($this->prefix . 'menus', function(Blueprint $table) {

            $table->engine = 'InnoDB';
            $table->increments('id')->unsigned();

            $table->string('name');
            $table->string('class')->nullable();

            $table->softDeletes();
            $table->timestamps();

        });

        Schema::create($this->prefix . 'menu_translations', function(Blueprint $table) {

            $table->engine = 'InnoDB';
            $table->increments('id')->unsigned();

            $table->boolean('status')->default(0);
            $table->string('title');

            $table->integer('menu_id')->unsigned()->index();
            $table->foreign('menu_id')->references('id')->on('menus')->onDelete('cascade');

            $table->integer('locale_id')->unsigned()->index();
            $table->foreign('locale_id')->references('id')->on('locales')->onDelete('cascade');

            $table->unique(['menu_id', 'locale_id']);

            $table->softDeletes();
            $table->timestamps();

        });
    }


    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop($this->prefix . 'menu_translations');
        Schema::drop($this->prefix . 'menus');
    }

}

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


class CreateMenulinksTable extends Migration
{

    public function __construct()
    {
        // Get the prefix
        $this->prefix = Config::get('general.general_db.prefix', '');
    }


    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create($this->prefix . 'menulinks', function(Blueprint $table) {

            $table->engine = 'InnoDB';
            $table->increments('id')->unsigned();

            $table->integer('menu_id')->unsigned();
            $table->integer('page_id')->unsigned()->nullable();
            $table->integer('parent_id')->unsigned()->nullable()->default(null);
            $table->integer('position')->unsigned()->default(1);
            $table->string('target', 10)->nullable();
            $table->string('class')->nullable();
            $table->string('icon_class')->nullable();
            $table->boolean('has_categories')->nullable();

            $table->softDeletes();
            $table->timestamps();

        });

        Schema::create($this->prefix . 'menulink_translations', function(Blueprint $table) {

            $table->engine = 'InnoDB';
            $table->increments('id')->unsigned();

            $table->boolean('status')->default(0);
            $table->string('title');
            $table->string('url')->nullable();

            $table->integer('menulink_id')->unsigned()->index();
            $table->foreign('menulink_id')->references('id')->on('menulinks')->onDelete('cascade');

            $table->integer('locale_id')->unsigned()->index();
            $table->foreign('locale_id')->references('id')->on('locales')->onDelete('cascade');

            $table->unique(['menulink_id', 'locale_id']);

            $table->softDeletes();
            $table->timestamps();

        });
    }


    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop($this->prefix . 'menulink_translations');
        Schema::drop($this->prefix . 'menulinks');
    }


}

Can this be closed?

P.S. I haven't been using PHP in quite some time (my system doesn't even have it installed at the moment) and haven't been using Laravel > 4.

I would love to focus my attention to other projects, so if anyone is interested in becoming a maintainer of this package, I'd love to hear it!