ActivityLogController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 25
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A index() 0 6 2
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