check image exist or not in laravel

Solutions on MaxInterview for check image exist or not in laravel by the best coders in the world

showing results for - "check image exist or not in laravel"
Anton
28 Jul 2016
1if(File::exists(public_path('images/1461177230.jpg'))){    dd('File is exists.');}else{    dd('File is not exists.');}
Oisin
07 Jul 2020
1if(file_exists(public_path('images/1461177230.jpg'))){    dd('File is exists.');}else{    dd('File is not exists.');}
Diego
31 Jun 2019
1// User Model
2public function photo()
3{
4    if (file_exists( public_path() . '/images/photos/account/' . $this->account_id . '.png')) {
5        return '/images/photos/account/' . $this->account_id .'.png';
6    } else {
7        return '/images/photos/account/default.png';
8    }     
9}
10
11// Blade Template
12<img src="{!! Auth::user()->photo() !!}" alt="">