ActivityLogController::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Http\Controllers\Controller;
6
use App\DataTables\ActivityLogDataTable;
7
use \Illuminate\Auth\Access\AuthorizationException;
8
use Illuminate\Support\Facades\Gate;
9
10
class ActivityLogController extends Controller
11
{
12
    /**
13
     * Create a new controller instance.
14
     *
15
     * @return void
16
     */
17
    public function __construct()
18
    {
19
        $this->middleware('auth');
20
    }
21
22
    /**
23
     * Display index page and process dataTable ajax request.
24
     *
25
     * @param ActivityLogDataTable $dataTable
26
     * @throws \Illuminate\Auth\Access\AuthorizationException
27
     * @return \Illuminate\Http\JsonResponse|\Illuminate\View\View
28
     */
29
    public function index(ActivityLogDataTable $dataTable)
30
    {
31
        if (Gate::denies('index-activitylog'))
32
            throw new AuthorizationException("This action is unauthorized.");
33
        else
34
            return $dataTable->render('activitylog.index');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $dataTable->render('activitylog.index') also could return the type callable which is incompatible with the documented return type Illuminate\Http\JsonResponse|Illuminate\View\View.
Loading history...
35
    }
36
37
}
38