@php $isEdit = filled($record); $namePrefix = $modalId.'_'; $mediaAssetUrl = static function ($asset) { if (! $asset?->file_path) { return null; } $path = $asset->file_path; if (str($path)->startsWith(['http://', 'https://', '/'])) { return $path; } if (str($path)->startsWith('storage/')) { return asset($path); } if (str($path)->startsWith('images/')) { return asset($path); } if (($asset->disk ?: 'public') === 'public') { return asset('storage/'.$path); } return \Illuminate\Support\Facades\Storage::disk($asset->disk)->url($path); }; $currentUrl = $mediaAssetUrl($record); @endphp @once @endonce