ViewLogController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 13
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 Inertia\Inertia;
6
7
use App\Models\AppSettings;
8
use App\Traits\LogUtilitiesTrait;
9
use App\Http\Controllers\Controller;
10
11
class ViewLogController extends Controller
12
{
13
    use LogUtilitiesTrait;
14
15
    /**
16
     * Show the log file
17
     */
18
    public function __invoke($channel, $filename)
19
    {
20
        $this->authorize('viewAny', AppSettings::class);
21
22
        $channel = $this->getChannelDetails($channel);
23
        if(!$channel)
24
        {
25
            abort(404);
26
        }
27
28
        $fileArr = $this->getFileToArray($filename, $channel);
29
30
        return Inertia::render('Logs/Show', [
31
            'levels'   => $this->logLevels,
32
            'channel'  => $channel,
33
            'filename' => $filename,
34
            'stats'    => [$this->getFileStats($fileArr, $filename)],
35
            'log_file' => $this->parseFile($fileArr),
36
        ]);
37
    }
38
}
39