Conditions | 2 |
Paths | 1 |
Total Lines | 26 |
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_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) { |
||
20 | $table->unsignedBigInteger('permission_id'); |
||
21 | |||
22 | $table->string('model_type'); |
||
23 | $table->unsignedBigInteger($columnNames['model_morph_key']); |
||
24 | $table->index([$columnNames['model_morph_key'], 'model_type',]); |
||
25 | |||
26 | $table->foreign('permission_id') |
||
27 | ->references('id') |
||
28 | ->on($tableNames['permissions']) |
||
29 | ->onDelete('cascade'); |
||
30 | |||
31 | $table->primary( |
||
32 | ['permission_id', $columnNames['model_morph_key'], 'model_type'], |
||
33 | 'model_has_permissions_permission_model_type_primary' |
||
34 | ); |
||
35 | }); |
||
36 | |||
37 | app('cache') |
||
38 | ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) |
||
39 | ->forget(config('permission.cache.key')); |
||
40 | } |
||
54 |