1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- class CreateAdminTables extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function getConnection()
- {
- return config('admin.database.connection') ?: config('database.default');
- }
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create(config('admin.database.users_table'), function (Blueprint $table) {
- $table->increments('id');
- $table->string('username', 190)->unique();
- $table->string('password', 60);
- $table->string('name');
- $table->string('avatar')->nullable();
- $table->string('remember_token', 100)->nullable();
- $table->timestamps();
- });
- Schema::create(config('admin.database.menu_table'), function (Blueprint $table) {
- $table->increments('id');
- $table->integer('parent_id')->default(0);
- $table->integer('order')->default(0);
- $table->string('title', 50);
- $table->string('icon', 50);
- $table->string('uri')->nullable();
- $table->timestamps();
- });
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists(config('admin.database.users_table'));
- Schema::dropIfExists(config('admin.database.menu_table'));
- }
- }
|