Conditions | 2 |
Paths | 1 |
Total Lines | 24 |
Lines | 24 |
Ratio | 100 % |
Tests | 19 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
14 | 51 | public function up() |
|
15 | { |
||
16 | 51 | $tableNames = config('permission.table_names'); |
|
17 | 51 | $columnNames = config('permission.column_names'); |
|
18 | |||
19 | Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { |
||
20 | 51 | $table->unsignedBigInteger('role_id'); |
|
21 | 51 | $table->string('model_type'); |
|
22 | 51 | $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
23 | 51 | $table->index([$columnNames['model_morph_key'], 'model_type',]); |
|
24 | 51 | $table->foreign('role_id') |
|
25 | 51 | ->references('id') |
|
26 | 51 | ->on($tableNames['roles']) |
|
27 | 51 | ->onDelete('cascade'); |
|
28 | 51 | $table->primary( |
|
29 | 51 | ['role_id', $columnNames['model_morph_key'], 'model_type'], |
|
30 | 51 | 'model_has_roles_role_model_type_primary' |
|
31 | ); |
||
32 | 51 | }); |
|
33 | |||
34 | 51 | app('cache') |
|
35 | 51 | ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) |
|
36 | 51 | ->forget(config('permission.cache.key')); |
|
37 | 51 | } |
|
38 | |||
51 |