Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Databases table structure, please? Thanks. #96

Closed
samiboukadida opened this issue Feb 16, 2015 · 2 comments
Closed

Databases table structure, please? Thanks. #96

samiboukadida opened this issue Feb 16, 2015 · 2 comments

Comments

@samiboukadida
Copy link

No description provided.

@illuminate3
Copy link

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');
    }


}

@vespakoen
Copy link
Owner

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants