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

ViewLogController::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 13
rs 9.9666
cc 1
nc 1
nop 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 Inertia\Inertia;
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
        $fileArr = $this->getFileToArray($filename, $channel);
24
25
        return Inertia::render('Logs/Show', [
26
            'levels'   => $this->logLevels,
27
            'channel'  => $channel,
28
            'filename' => $filename,
29
            'stats'    => [$this->getFileStats($fileArr, $filename)],
30
            'log_file' => $this->parseFile($fileArr),
31
        ]);
32
    }
33
}
34