Completed
Push — device_ip ( 1d928b...ddfcff )
by Tony
03:21 queued 11s
created

DeviceController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\DataTables\DeviceDataTable;
6
use Dingo\Api\Http;
7
use Dingo\Api\Routing\Helpers;
8
use Illuminate\Http\Request;
9
10
class DeviceController extends Controller
11
{
12
    use Helpers;
13
14
    /**
15
     * Constructor
16
     */
17
    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...
18
        $this->middleware('auth');
19
    }
20
21
    /**
22
     * Display a listing of the resource.
23
     *
24
     * @return \Illuminate\Http\JsonResponse|\Illuminate\View\View
25
     */
26
    public function index(DeviceDataTable $dataTable)
27
    {
28
        return $dataTable->render('devices.list');
29
    }
30
31
    /**
32
     * Show the form for creating a new resource.
33
     *
34
     * @return \Illuminate\Http\Response
35
     */
36
    public function create()
37
    {
38
        // add new device form
39
        return view('devices.create');
40
    }
41
42
    /**
43
     * Store a newly created resource in storage.
44
     *
45
     * @param  \Illuminate\Http\Request  $request
46
     * @return \Illuminate\Http\RedirectResponse
47
     */
48
    public function store(Request $request)
49
    {
50
        // save device
51
52
        $this->validate($request, [
53
            'hostname'        => 'required|unique:devices|max:128',
54
            'snmpver'         => 'required|alpha_num|max:4',
55
            'transport'       => 'required|alpha_num|max:16',
56
            'port_assoc_mode' => 'required|alpha',
57
            'community'       => 'required_if:snmpver,v1,v2c|max:255',
58
            'authlevel'       => 'required_if:snmpver,v3|alpha|max:15',
59
            'authname'        => 'required_if:authlevel,authNoPriv|max:64',
60
            'authalgo'        => 'required_if:authlevel,authNoPriv|in:MD5,SHA|max:3',
61
            'cryptopass'      => 'required_if:authlevel,authPriv|max:64',
62
            'cryptoalgo'      => 'required_if:authlevel,authPriv|in:AES,DES|max:3',
63
        ]);
64
        return redirect()->route('devices.index');
65
    }
66
67
    /**
68
     * Display the specified resource.
69
     *
70
     * @param  int  $id
71
     * @return \Illuminate\Http\Response
72
     */
73
    public function show($id)
0 ignored issues
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...
74
    {
75
        // show a single device
76
    }
77
78
    /**
79
     * Show the form for editing the specified resource.
80
     *
81
     * @param  int  $id
82
     * @return \Illuminate\Http\Response
83
     */
84
    public function edit($id)
0 ignored issues
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...
85
    {
86
        //edit device form??
87
    }
88
89
    /**
90
     * Update the specified resource in storage.
91
     *
92
     * @param  \Illuminate\Http\Request  $request
93
     * @param  int  $id
94
     * @return \Illuminate\Http\Response
95
     */
96
    public function update(Request $request, $id)
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...
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...
97
    {
98
        //process device modify
99
    }
100
101
    /**
102
     * Remove the specified resource from storage.
103
     *
104
     * @param  int  $id
105
     * @return \Illuminate\Http\Response
106
     */
107
    public function destroy($id)
0 ignored issues
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...
108
    {
109
        // delete device
110
    }
111
}
112