Passed
Push — main ( 0c0937...7a01df )
by PRATIK
03:45
created

ReorderBlock   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

2 Methods

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