File size: 648 Bytes
5f32fbd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | <?php
declare(strict_types=1);
namespace App\Support;
use Illuminate\Foundation\Vite as BaseVite;
class Vite extends BaseVite
{
protected function assetPath($path, $secure = null)
{
$baseUrl = str_replace('http://', '//', $this->getDomain());
$path = $baseUrl . '/' . ltrim($path, '/');
return ($this->assetPathResolver ?? asset(...))($path, $secure);
}
private function getDomain()
{
if (file_exists(storage_path('installed'))) {
$domain = config('app.url');
} else {
$domain = request()->getSchemeAndHttpHost();
}
return $domain;
}
}
|