for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSpatieRoleHasPermissionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
$tableNames = config('permission.table_names');
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
$table->unsignedBigInteger('permission_id');
$table->unsignedBigInteger('role_id');
$table->foreign('permission_id')
->references('id')
->on($tableNames['permissions'])
->onDelete('cascade');
$table->foreign('role_id')
->on($tableNames['roles'])
$table->primary(['permission_id', 'role_id']);
});
app('cache')
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
->forget(config('permission.cache.key'));
}
* Reverse the migrations.
public function down()
Schema::drop($tableNames['role_has_permissions']);