laravel if file exist code example
Example 1: check if file exists laravel
$file = public_path('storage/images/' . $value)
if(! file_exists($file)){
return asset('storage/images/default.png');
}
Example 2: assert file exists laravel
// From https://laravel-news.com/testing-file-uploads-with-laravel
Storage::disk('avatars')->assertExists('avatar.jpg');