Passed
Push — master ( 3c4def...f95ae3 )
by Jonathan
19:33 queued 09:29
created

RenameRelatedlistWidgetClass   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 7 2
A up() 0 7 2
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Uccello\Core\Models\Widget;
5
6
class RenameRelatedlistWidgetClass extends Migration
7
{
8
    /**
9
     * Run the migrations.
10
     *
11
     * @return void
12
     */
13
    public function up()
14
    {
15
        $widgets = Widget::where('class', 'Uccello\Core\Widgets\Relatedlist')->get();
16
17
        foreach ($widgets as $widget) {
18
            $widget->class = 'Uccello\Core\Widgets\RelatedlistWidget';
0 ignored issues
show
Bug introduced by
The property class does not seem to exist on Uccello\Core\Models\Widget. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
19
            $widget->save();
20
        }
21
    }
22
23
    /**
24
     * Reverse the migrations.
25
     *
26
     * @return void
27
     */
28
    public function down()
29
    {
30
        $widgets = Widget::where('class', 'Uccello\Core\Widgets\RelatedlistWidget')->get();
31
32
        foreach ($widgets as $widget) {
33
            $widget->class = 'Uccello\Core\Widgets\Relatedlist';
0 ignored issues
show
Bug introduced by
The property class does not seem to exist on Uccello\Core\Models\Widget. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
34
            $widget->save();
35
        }
36
    }
37
}
38