Completed
Pull Request — master (#11)
by claudio
04:50
created

GroupsController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4286
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
namespace plunner\Http\Controllers\Employees\Planners;
4
5
use plunner\Group;
6
use plunner\Http\Controllers\Controller;
7
use plunner\Http\Requests;
8
use plunner\Planner;
9
10
class GroupsController extends Controller
11
{
12
    /**
13
     * @var plunner/Employee
14
     */
15
    private $user;
0 ignored issues
show
Unused Code introduced by
The property $user is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
16
17
    /**
18
     * ExampleController constructor.
19
     */
20 8
    public function __construct()
21
    {
22 8
        config(['auth.model' => Planner::class]);
23 8
        config(['jwt.user' => Planner::class]);
24 8
        $this->middleware('jwt.authandrefresh:mode-en');
25 8
    }
26
27
    /**
28
     * Display a listing of the resource.
29
     *
30
     * @return \Illuminate\Http\Response
31
     */
32 2
    public function index()
33
    {
34
        /**
35
         * @var $planner Planner
36
         */
37 2
        $planner = \Auth::user();
38 2
        return $planner->GroupsManaged;
0 ignored issues
show
Bug introduced by
The property GroupsManaged does not seem to exist. Did you mean groupsManaged?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
39
    }
40
41
    /**
42
     * Display the specified resource.
43
     *
44
     * @param  int  $id
45
     * @return \Illuminate\Http\Response
46
     */
47 4
    public function show($id)
48
    {
49 4
        $group = Group::with('employees')->findOrFail($id);
50 4
        $this->authorize($group);
51 2
        return $group;
52
    }
53
}
54