Test Failed
Push — dev6 ( bf43a6...5a7ea5 )
by Ron
16:37
created

LogFilesController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 11
c 1
b 0
f 0
dl 0
loc 25
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 18 2
1
<?php
2
3
namespace App\Http\Controllers\Admin\Logs;
4
5
use App\Http\Controllers\Controller;
6
use App\Models\AppSettings;
7
use App\Traits\LogUtilitiesTrait;
8
use Illuminate\Http\Request;
9
use Illuminate\Support\Arr;
10
use Inertia\Inertia;
11
12
class LogFilesController extends Controller
13
{
14
    use LogUtilitiesTrait;
15
16
    /**
17
     *  View a list of log files
18
     */
19
    public function __invoke($channel = null)
20
    {
21
        $this->authorize('viewAny', AppSettings::class);
22
23
        $props = [];
24
25
        if(!is_null($channel))
26
        {
27
            $props = [
28
                'channel'   => $channel,
29
                'log_files' => $this->getChannelStats($channel),
30
                'levels'    => $this->logLevels,
31
            ];
32
        }
33
34
        $props['channels'] = Arr::pluck($this->logChannels, 'name');
35
36
        return Inertia::render('Logs/Index', $props);
37
    }
38
}
39