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