Total Complexity | 3 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
7 | class AddDisplaytypes extends Migration |
||
8 | { |
||
9 | /** |
||
10 | * Run the migrations. |
||
11 | * |
||
12 | * @return void |
||
13 | */ |
||
14 | public function up() |
||
15 | { |
||
16 | $displaytypes = [ |
||
17 | 'create_detail' => 'Uccello\Core\Fields\Displaytype\CreateDetail', |
||
18 | 'list_only' => 'Uccello\Core\Fields\Displaytype\ListOnly', |
||
19 | ]; |
||
20 | |||
21 | foreach ($displaytypes as $name => $class) { |
||
22 | $displaytype = new Displaytype(); |
||
23 | $displaytype->name = $name; |
||
|
|||
24 | $displaytype->class = $class; |
||
25 | $displaytype->save(); |
||
26 | } |
||
27 | |||
28 | Artisan::call('cache:clear'); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Reverse the migrations. |
||
33 | * |
||
34 | * @return void |
||
35 | */ |
||
36 | public function down() |
||
43 | } |
||
44 | } |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.