1if(File::exists(public_path('images/1461177230.jpg'))){ dd('File is exists.');}else{ dd('File is not exists.');}
1if(file_exists(public_path('images/1461177230.jpg'))){ dd('File is exists.');}else{ dd('File is not exists.');}
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="">