Passed
Push — main ( 6877e3...35b0cf )
by PRATIK
04:14
created

ReorderPackage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 14
rs 10
c 1
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 4 1
A updatePackageOrder() 0 6 2
1
<?php
2
3
namespace Adminetic\Website\Http\Livewire\Admin\Package;
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 Illuminate\Support\Facades\Cache;
7
use Adminetic\Website\Models\Admin\Package;
8
9
class ReorderPackage extends Component
10
{
11
    public function updatePackageOrder($lists)
12
    {
13
        foreach ($lists as $list) {
14
            Package::find($list['value'])->update(['position' => $list['order']]);
15
        }
16
        $this->emit('reorderingComplete');
17
    }
18
19
    public function render()
20
    {
21
        $packages = Cache::get('packages', Package::orderBy('position')->get());
22
        return view('website::livewire.admin.package.reorder-package', compact('packages'));
23
    }
24
}
25