feat: add storage_url helper function and update image URL retrieval to use public disk
This commit is contained in:
@@ -31,3 +31,20 @@ if (!function_exists('hook')) {
|
||||
return \App\Helpers\EventHelper::renderEvent($event);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('storage_url')) {
|
||||
/**
|
||||
* Get the URL for a file stored on the public disk
|
||||
*
|
||||
* @param string|null $path
|
||||
* @return string|null
|
||||
*/
|
||||
function storage_url(?string $path): ?string
|
||||
{
|
||||
if (!$path) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return \Illuminate\Support\Facades\Storage::disk('public')->url($path);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user