Skip to content

Commit 6ccf050

Browse files
fix(theme): issue with assets url and some third librarie
Wrong theme assets url generated when used with library like stancl/tenancy
1 parent 6d6e2e5 commit 6ccf050

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Theme.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,10 @@ public function url($url, $absolutePath = true, bool $version = true): ?string
313313
$fullUrl = ltrim(str_replace('\\', '/', $fullUrl), '/');
314314
$versionTag = hash_file('md5', public_path($fullUrl));
315315

316-
return ($absolutePath ? asset('') . $fullUrl : $fullUrl) . ($version ? '?v=' . $versionTag : '');
316+
return ($absolutePath ? url('/') . '/' . $fullUrl : $fullUrl) . ($version ? '?v=' . $versionTag : '');
317317
}
318318

319+
319320
// If not found then lookup in parent's theme assets path
320321
if ($parentTheme = $this->getParent()) {
321322
return $parentTheme->url($url, $absolutePath, $version);
@@ -324,7 +325,7 @@ public function url($url, $absolutePath = true, bool $version = true): ?string
324325
$url = ltrim(str_replace('\\', '/', $url), '/');
325326
$versionTag = hash_file('md5', public_path($url));
326327

327-
return ($absolutePath ? asset('') . $url : $url) . ($version ? '?v=' . $versionTag : '');
328+
return ($absolutePath ? url('/') . '/' . $url : $url) . ($version ? '?v=' . $versionTag : '');
328329
}
329330

330331
Log::warning("Asset [{$url}] not found for Theme [{$this->getName()}]");

0 commit comments

Comments
 (0)