|
@@ 37-51 (lines=15) @@
|
| 34 |
|
$table->timestamps(); |
| 35 |
|
}); |
| 36 |
|
|
| 37 |
|
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) { |
| 38 |
|
$table->unsignedBigInteger('permission_id'); |
| 39 |
|
|
| 40 |
|
$table->string('model_type'); |
| 41 |
|
$table->unsignedBigInteger($columnNames['model_morph_key']); |
| 42 |
|
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index'); |
| 43 |
|
|
| 44 |
|
$table->foreign('permission_id') |
| 45 |
|
->references('id') |
| 46 |
|
->on($tableNames['permissions']) |
| 47 |
|
->onDelete('cascade'); |
| 48 |
|
|
| 49 |
|
$table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'], |
| 50 |
|
'model_has_permissions_permission_model_type_primary'); |
| 51 |
|
}); |
| 52 |
|
|
| 53 |
|
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { |
| 54 |
|
$table->unsignedBigInteger('role_id'); |
|
@@ 53-67 (lines=15) @@
|
| 50 |
|
'model_has_permissions_permission_model_type_primary'); |
| 51 |
|
}); |
| 52 |
|
|
| 53 |
|
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { |
| 54 |
|
$table->unsignedBigInteger('role_id'); |
| 55 |
|
|
| 56 |
|
$table->string('model_type'); |
| 57 |
|
$table->unsignedBigInteger($columnNames['model_morph_key']); |
| 58 |
|
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index'); |
| 59 |
|
|
| 60 |
|
$table->foreign('role_id') |
| 61 |
|
->references('id') |
| 62 |
|
->on($tableNames['roles']) |
| 63 |
|
->onDelete('cascade'); |
| 64 |
|
|
| 65 |
|
$table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'], |
| 66 |
|
'model_has_roles_role_model_type_primary'); |
| 67 |
|
}); |
| 68 |
|
|
| 69 |
|
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { |
| 70 |
|
$table->unsignedBigInteger('permission_id'); |