HandleInertiaRequests::version()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace App\Http\Middleware;
4
5
use Illuminate\Http\Request;
6
use Inertia\Middleware;
7
8
class HandleInertiaRequests extends Middleware
9
{
10
    /**
11
     * The root template that is loaded on the first page visit.
12
     *
13
     * @var string
14
     */
15
    protected $rootView = 'app';
16
17
    /**
18
     * Determine the current asset version.
19
     */
20
    public function version(Request $request): string|null
21
    {
22
        return parent::version($request);
23
    }
24
25
    /**
26
     * Define the props that are shared by default.
27
     *
28
     * @return array<string, mixed>
29
     */
30
    public function share(Request $request): array
31
    {
32
        return [
33
            ...parent::share($request),
34
            'auth' => [
35
                'user' => $request->user(),
0 ignored issues
show
Bug introduced by
The method user() does not exist on Illuminate\Http\Request. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
                'user' => $request->/** @scrutinizer ignore-call */ user(),

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
            ],
37
        ];
38
    }
39
}
40