laravel storage check file exists
Storage::disk('public')->exists($image)
laravel storage check file exists
Storage::disk('public')->exists($image)
image exists in laravel
if(File::exists(public_path('images/1461177230.jpg'))){ dd('File is exists.');}else{ dd('File is not exists.');}
image exists in laravel
if(file_exists(public_path('images/1461177230.jpg'))){ dd('File is exists.');}else{ dd('File is not exists.');}
check image exist or not in laravel
// User Model
public function photo()
{
if (file_exists( public_path() . '/images/photos/account/' . $this->account_id . '.png')) {
return '/images/photos/account/' . $this->account_id .'.png';
} else {
return '/images/photos/account/default.png';
}
}
// Blade Template
<img src="{!! Auth::user()->photo() !!}" alt="">
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us