Completed
Push — master ( b271b8...ef0682 )
by wen
03:13
created

AdminController::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
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
        return view('admin::app');
25
    }
26
27
    public function store()
28
    {
29
    }
30
31
    public function edit(ConfigContract $config, $id)
32
    {
33
        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...
34
    }
35
36
    public function update()
37
    {
38
    }
39
40
    public function delete(ConfigContract $config, $id)
41
    {
42
        $config->getModel()->delete($id);
43
        return response()->json(['message' => 'ok']);
44
    }
45
46
    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...
47
    {
48
    }
49
50
    public function forceDelete(ConfigContract $config, $id)
51
    {
52
        $config->getModel()->forceDelete($id);
53
        return response()->json(['message' => 'ok']);
54
    }
55
56
    public function restore(ConfigContract $config, $id)
57
    {
58
        $config->getModel()->restore($id);
59
        return response()->json(['message' => 'ok']);
60
    }
61
}
62