vmailadmin/database/migrations/2016_01_26_115212_create_permissions_table.php
2020-05-23 15:20:01 +02:00

45 lines
1.2 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePermissionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$connection = config('roles.connection');
$table = config('roles.permissionsTable');
$tableCheck = Schema::connection($connection)->hasTable($table);
if (!$tableCheck) {
Schema::connection($connection)->create($table, function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->string('name');
$table->string('slug')->unique();
$table->string('description')->nullable();
$table->string('model')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$connection = config('roles.connection');
$table = config('roles.permissionsTable');
Schema::connection($connection)->dropIfExists($table);
}
}