Completed
Pull Request — master (#11)
by
unknown
02:28
created

EmployeesController::show()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 9.4286
cc 1
eloc 4
nc 1
nop 1
crap 2
1
<?php
2
3
namespace plunner\Http\Controllers\Employees;
4
5
use plunner\Http\Controllers\Controller;
6
use plunner\Http\Requests;
7
use plunner\Employee;
8
9
class EmployeesController extends Controller
10
{
11
    /**
12
     * @var plunner/Employee
13
     */
14
    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...
15
16
    /**
17
     * ExampleController constructor.
18
     */
19
    public function __construct()
20
    {
21
        config(['auth.model' => \plunner\Employee::class]);
22
        config(['jwt.user' => \plunner\Employee::class]);
23
        $this->middleware('jwt.authandrefresh:mode-en');
24
    }
25
26
    /**
27
     * Display a listing of the resource.
28
     *
29
     * @return \Illuminate\Http\Response
30
     */
31
    public function index()
32
    {
33
        $employee = \Auth::user();
34
        return $employee;
35
    }
36
37
    //TODO this is not RESTFUL, but it can be ok
38
39
    /**
40
     * Display the specified resource.
41
     *
42
     * @param  int  $id
43
     * @return \Illuminate\Http\Response
44
     */
45
    public function show($id)
46
    {
47
        $employee = Employee::findOrFail($id);
48
        $this->authorize($employee);
49
        return $employee;
50
    }
51
52
    //TODO why this? when we need this?
53
}
54