1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Middleware; |
4
|
|
|
|
5
|
|
|
use App\Actions\General\BuildNavbar; |
|
|
|
|
6
|
|
|
use Illuminate\Http\Request; |
7
|
|
|
use Inertia\Middleware; |
8
|
|
|
use PragmaRX\Version\Package\Version; |
9
|
|
|
|
10
|
|
|
class HandleInertiaRequests extends Middleware |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* The root template that's loaded on the first page visit. |
14
|
|
|
*/ |
15
|
|
|
protected $rootView = 'app'; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Determines the current asset version. |
19
|
|
|
*/ |
20
|
28 |
|
public function version(Request $request) |
21
|
|
|
{ |
22
|
28 |
|
return parent::version($request); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Defines the props that are shared by default. |
27
|
|
|
*/ |
28
|
198 |
|
public function share(Request $request) |
29
|
|
|
{ |
30
|
198 |
|
return array_merge(parent::share($request), [ |
31
|
|
|
// Flash messages are used for success/failure messages on next page load |
32
|
|
|
'flash' => [ |
33
|
198 |
|
'message' => fn() => $request->session()->get('message'), |
34
|
198 |
|
'type' => fn() => $request->session()->get('type'), |
35
|
|
|
], |
36
|
|
|
// App information that is shared and used on all pages |
37
|
|
|
'app' => [ |
38
|
198 |
|
'name' => config('app.name'), |
39
|
198 |
|
'logo' => config('app.logo'), |
40
|
198 |
|
'version' => (new Version)->full(), |
41
|
|
|
// Current logged in user |
42
|
|
|
'user' => fn() => $request->user() ? $request->user() : null, |
43
|
198 |
|
// File information |
44
|
|
|
'fileData' => [ |
45
|
198 |
|
'maxSize' => config('filesystems.max_filesize'), |
46
|
|
|
'chunkSize' => config('filesystems.chunk_size'), |
47
|
|
|
'token' => csrf_token(), |
48
|
198 |
|
], |
49
|
198 |
|
], |
50
|
198 |
|
// Dynamically built navigation menu |
51
|
|
|
'navBar' => fn() => $request->user() ? (new BuildNavbar)->build($request->user()) : [], |
52
|
|
|
]); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths