Skip to content

Commit 5909533

Browse files
Merge pull request #658 from RobertBoes/use-asset-url-only-on-vapor
Update versioning in middleware
2 parents 206b1ba + 3660019 commit 5909533

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/Middleware.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Inertia\Support\Header;
77
use Illuminate\Http\Request;
88
use Illuminate\Support\Facades\Redirect;
9+
use Inertia\Support\LaravelVapor;
910
use Symfony\Component\HttpFoundation\Response;
1011

1112
class Middleware
@@ -28,7 +29,7 @@ class Middleware
2829
*/
2930
public function version(Request $request)
3031
{
31-
if (config('app.asset_url')) {
32+
if (LaravelVapor::detect()) {
3233
return md5(config('app.asset_url'));
3334
}
3435

src/Support/LaravelVapor.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Inertia\Support;
4+
5+
use Laravel\Vapor\Vapor;
6+
7+
class LaravelVapor
8+
{
9+
public static function detect(): bool
10+
{
11+
if (class_exists(Vapor::class)) {
12+
return Vapor::active();
13+
}
14+
15+
return false;
16+
}
17+
}

0 commit comments

Comments
 (0)