ActivityLogController::index()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 6
ccs 0
cts 4
cp 0
crap 6
rs 9.4285
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