Completed
Push — device-groups ( cccab4...a9d029 )
by Tony
03:45
created

DeviceGroupController   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 4 1
A create() 0 4 1
A store() 0 4 1
A show() 0 4 1
A edit() 0 5 1
A update() 0 5 1
A destroy() 0 4 1
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\DataTables\DeviceGroupDataTable;
6
use App\Models\DeviceGroup;
7
use Illuminate\Http\Request;
8
9
use App\Http\Requests;
10
11
class DeviceGroupController extends Controller
12
{
13
    /**
14
     * Display a listing of the resource.
15
     *
16
     * @param DeviceGroupDataTable $dataTable
17
     * @return \Illuminate\Http\Response
18
     */
19
    public function index(DeviceGroupDataTable $dataTable)
20
    {
21
        return $dataTable->render('devices.group-list');
22
    }
23
24
    /**
25
     * Show the form for creating a new resource.
26
     *
27
     * @return \Illuminate\Http\Response
28
     */
29
    public function create()
30
    {
31
        return view('devices.group-edit');
32
    }
33
34
    /**
35
     * Store a newly created resource in storage.
36
     *
37
     * @param  \Illuminate\Http\Request  $request
38
     * @return \Illuminate\Http\Response
39
     */
40
    public function store(Request $request)
41
    {
42
        DeviceGroup::create($request->all());
43
    }
44
45
    /**
46
     * Display the specified resource.
47
     *
48
     * @param  int  $id
49
     * @return \Illuminate\Http\Response
50
     */
51
    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...
52
    {
53
        //
54
    }
55
56
    /**
57
     * Show the form for editing the specified resource.
58
     *
59
     * @param  int  $id
60
     * @return \Illuminate\Http\Response
61
     */
62
    public function edit($id)
63
    {
64
        $group = DeviceGroup::findOrFail($id);
65
        return view('devices.group-edit')->withGroup($group);
66
    }
67
68
    /**
69
     * Update the specified resource in storage.
70
     *
71
     * @param  \Illuminate\Http\Request  $request
72
     * @param  int  $id
73
     * @return \Illuminate\Http\Response
74
     */
75
    public function update(Request $request, $id)
76
    {
77
        $group = DeviceGroup::find($id);
78
        $group->update($request->all());
79
    }
80
81
    /**
82
     * Remove the specified resource from storage.
83
     *
84
     * @param  int  $id
85
     * @return \Illuminate\Http\Response
86
     */
87
    public function destroy($id)
88
    {
89
        DeviceGroup::destroy($id);
90
    }
91
}
92