Passed
Push — main ( 21b81c...b80092 )
by PRATIK
14:07
created

ReorderPopup   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

2 Methods

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