TenantAtlas/apps/platform/app/Support/Filament/PanelThemeAsset.php
2026-04-08 09:33:16 +02:00

32 lines
720 B
PHP

<?php
namespace App\Support\Filament;
use Illuminate\Support\Facades\Vite;
class PanelThemeAsset
{
public static function resolve(string $entry): ?string
{
if (is_file(public_path('hot'))) {
return Vite::asset($entry);
}
$manifest = public_path('build/manifest.json');
if (! is_file($manifest)) {
return null;
}
/** @var array<string, array{file?: string}>|null $decoded */
$decoded = json_decode((string) file_get_contents($manifest), true);
$file = $decoded[$entry]['file'] ?? null;
if (! is_string($file) || $file === '') {
return null;
}
return asset('build/'.$file);
}
}