Completed
Push — master ( 46aff2...b271b8 )
by wen
02:45
created

AdminController   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 5
Bugs 1 Features 1
Metric Value
wmc 10
lcom 0
cbo 4
dl 0
loc 52
rs 10
c 5
b 1
f 1

10 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 3 1
A store() 0 3 1
A getList() 0 5 1
A config() 0 4 1
A update() 0 3 1
A edit() 0 4 1
A delete() 0 5 1
A batchDelete() 0 3 1
A destroy() 0 5 1
A restore() 0 5 1
1
<?php
2
3
4
namespace Sco\Admin\Http\Controllers;
5
6
use Illuminate\Routing\Controller;
7
use Sco\Admin\Contracts\Config as ConfigContract;
8
9
class AdminController extends Controller
10
{
11
    public function getList(ConfigContract $config)
12
    {
13
        $model = $config->getModel();
14
        return $model->get();
15
    }
16
17
    public function config(ConfigContract $config)
18
    {
19
        return $config->getConfigs();
20
    }
21
22
    public function create()
23
    {
24
    }
25
26
    public function store()
27
    {
28
    }
29
30
    public function edit(ConfigContract $config, $id)
31
    {
32
        dd($config->getModel()->find($id)) ;
0 ignored issues
show
Bug introduced by
The method find() does not seem to exist on object<Sco\Admin\Config\ModelConfig>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33
    }
34
35
    public function update()
36
    {
37
    }
38
39
    public function delete(ConfigContract $config, $id)
40
    {
41
        $config->getModel()->delete($id);
42
        return response()->json(['message' => 'ok']);
43
    }
44
45
    public function batchDelete(ConfigContract $config)
0 ignored issues
show
Unused Code introduced by
The parameter $config is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
46
    {
47
    }
48
49
    public function destroy(ConfigContract $config, $id)
50
    {
51
        $config->getModel()->destroy($id);
52
        return response()->json(['message' => 'ok']);
53
    }
54
55
    public function restore(ConfigContract $config, $id)
56
    {
57
        $config->getModel()->restore($id);
0 ignored issues
show
Bug introduced by
The method restore() does not seem to exist on object<Sco\Admin\Config\ModelConfig>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
58
        return response()->json(['message' => 'ok']);
59
    }
60
}
61