check if file exists laravel 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: php check if file exists
if (!file_exists('http://mysite.com/images/thumbnail_1286954822.jpg')) {
$filefound = '0';
}
Example 3: assert file exists laravel
// From https://laravel-news.com/testing-file-uploads-with-laravel
Storage::disk('avatars')->assertExists('avatar.jpg');