Completed
Push — develop ( 5f1168...aa9d13 )
by Daniel
05:30
created

DeviceController::index()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use Dingo\Api\Http;
6
use Dingo\Api\Routing\Router;
7
use Dingo\Api\Routing\Helpers;
8
use App\Http\Requests;
9
use Illuminate\Http\Request;
10
use JWTAuth;
11
12
class DeviceController extends Controller
13
{
14
    use Helpers;
15
16
    /**
17
     * Constructor
18
     */
19
    public function __construct(Request $request) {
1 ignored issue
show
Unused Code introduced by
The parameter $request 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...
20
        $this->middleware('auth');
21
    }
22
23
    /**
24
     * Display a listing of the resource.
25
     *
26
     * @return \Illuminate\Http\Response
27
     */
28
    public function index()
29
    {
30
        $devices = $this->api->be(auth()->user())->get('/api/devices');
0 ignored issues
show
Bug introduced by
The method user() does not seem to exist on object<Illuminate\Contracts\Auth\Factory>.

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...
31
        return view('devices.list', ['devices'=>$devices]);
32
    }
33
34
    /**
35
     * Show the form for creating a new resource.
36
     *
37
     * @return \Illuminate\Http\Response
38
     */
39
    public function create()
40
    {
41
        // add new device form
42
        return view('devices.create');
43
    }
44
45
    /**
46
     * Store a newly created resource in storage.
47
     *
48
     * @param  \Illuminate\Http\Request  $request
49
     * @return \Illuminate\Http\Response
50
     */
51
    public function store(Request $request)
1 ignored issue
show
Unused Code introduced by
The parameter $request 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...
52
    {
53
        // save device
54
        return redirect()->route('devices.index');
55
    }
56
57
    /**
58
     * Display the specified resource.
59
     *
60
     * @param  int  $id
61
     * @return \Illuminate\Http\Response
62
     */
63
    public function show($id)
1 ignored issue
show
Unused Code introduced by
The parameter $id 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...
64
    {
65
        // show a single device
66
    }
67
68
    /**
69
     * Show the form for editing the specified resource.
70
     *
71
     * @param  int  $id
72
     * @return \Illuminate\Http\Response
73
     */
74
    public function edit($id)
1 ignored issue
show
Unused Code introduced by
The parameter $id 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...
75
    {
76
        //edit device form??
77
    }
78
79
    /**
80
     * Update the specified resource in storage.
81
     *
82
     * @param  \Illuminate\Http\Request  $request
83
     * @param  int  $id
84
     * @return \Illuminate\Http\Response
85
     */
86
    public function update(Request $request, $id)
2 ignored issues
show
Unused Code introduced by
The parameter $request 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...
Unused Code introduced by
The parameter $id 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...
87
    {
88
        //process device modify
89
    }
90
91
    /**
92
     * Remove the specified resource from storage.
93
     *
94
     * @param  int  $id
95
     * @return \Illuminate\Http\Response
96
     */
97
    public function destroy($id)
1 ignored issue
show
Unused Code introduced by
The parameter $id 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...
98
    {
99
        // delete device
100
    }
101
}
102