Completed
Push — master ( a7b5fe...4405b1 )
by wen
03:16
created

AdminController::index()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 1
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Sco\Admin\Http\Controllers;
4
5
use Illuminate\Routing\Controller;
6
use Sco\Admin\Contracts\ModelFactoryInterface;
7
8
class AdminController extends Controller
9
{
10
    public function index()
11
    {
12
        return view('admin::app');
13
    }
14
15
    public function getList(ModelFactoryInterface $modelFactory)
16
    {
17
        return $modelFactory->get();
18
    }
19
20
    public function config(ModelFactoryInterface $modelFactory)
21
    {
22
        return $modelFactory->getConfigManager();
23
    }
24
25
    public function create()
26
    {
27
        return view('admin::app');
28
    }
29
30
    public function store(ModelFactoryInterface $modelFactory)
31
    {
32
        $modelFactory->store();
33
    }
34
35
    public function edit(ModelFactoryInterface $modelFactory, $id)
36
    {
37
        dd($modelFactory->find($id));
0 ignored issues
show
Bug introduced by
The method find() does not seem to exist on object<Sco\Admin\Contracts\ModelFactoryInterface>.

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...
38
    }
39
40
    public function update()
41
    {
42
    }
43
44
    public function delete(ModelFactoryInterface $modelFactory, $id)
45
    {
46
        $modelFactory->delete($id);
47
        return response()->json(['message' => 'ok']);
48
    }
49
50
    public function batchDelete(ModelFactoryInterface $modelFactory)
0 ignored issues
show
Unused Code introduced by
The parameter $modelFactory 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...
51
    {
52
    }
53
54
    public function forceDelete(ModelFactoryInterface $modelFactory, $id)
55
    {
56
        $modelFactory->forceDelete($id);
57
        return response()->json(['message' => 'ok']);
58
    }
59
60
    public function restore(ModelFactoryInterface $modelFactory, $id)
61
    {
62
        $modelFactory->restore($id);
63
        return response()->json(['message' => 'ok']);
64
    }
65
}
66