Passed
Push — main ( 52a9ba...b89683 )
by PRATIK
04:37 queued 14s
created

ReorderChildrenCategory::childPositionReorder()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Adminetic\Website\Http\Livewire\Admin\Category;
4
5
use Livewire\Component;
0 ignored issues
show
Bug introduced by
The type Livewire\Component was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Adminetic\Website\Models\Admin\Category;
7
8
class ReorderChildrenCategory extends Component
9
{
10
    public $category_id;
11
12
    public function mount($category_id)
13
    {
14
        $this->category_id = $category_id;
15
    }
16
17
    public function childPositionReorder($lists)
18
    {
19
        foreach ($lists as $list) {
20
            Category::find($list['value'])->update(['position' => $list['order']]);
21
        }
22
        $this->emit('reorderingComplete');
23
    }
24
25
    public function render()
26
    {
27
        $category = Category::find($this->category_id);
28
        return view('website::livewire.admin.category.reorder-children-category', compact('category'));
29
    }
30
}
31