'How can I check that file returned by laravel-medialibrary getUrl method really exists?

In laravel 8 app I use spatie/laravel-medialibrary 9 and how can I check that file returned by getUrl really exists under storage in code :

foreach (Auth::user()->getMedia('avatar') as $mediaImage) {
    \Log::info(  varDump($mediaImage, ' -1 $mediaImage::') );
    return $mediaImage->getUrl();
}

?

$mediaImage var has data like:

 Array
(
    [id] => 11
    [model_type] => App\Models\User
    [model_id] => 1
    [uuid] => 2fb4fa16-cbdc-4902-bdf5-d7e6d738d91f
    [collection_name] => avatar
    [name] => b22de6791bca17184093c285e1c4b4b5
    [file_name] => avatar_111.jpg
    [mime_type] => image/jpg
    [disk] => public
    [conversions_disk] => public
    [size] => 14305
    [manipulations] => Array
        (
        )

    [custom_properties] => Array
        (
        )

    [generated_conversions] => Array
        (
        )

    [responsive_images] => Array
        (
        )

    [order_column] => 1
    [created_at] => 2021-12-30T14:08:11.000000Z
    [updated_at] => 2021-12-30T14:08:11.000000Z
    [original_url] => http://127.0.0.1:8000/storage/Photos/11/avatar_111.jpg
    [preview_url] => 
)

Looks like nothing about file under storage...

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source