title: Laravel 5.6:Check if a file exists
body: <p>So i'm creating user profiles in laravel and want to show a generic profile image if the user hasn't uploaded his/her own profile image with the following if/else condition:</p>
  
  <pre><code>@if(false)
      &lt;img src="img/uploads/avatars/{{$user-&gt;Uname}}" class="img-thumbnail" alt="{{$user-&gt;Uname}}'s Profile Pic"&gt;
  @else
      &lt;img src="img/uploads/avatars/{{$user-&gt;avatar}}" class="img-thumbnail" alt="{{$user-&gt;Uname}}'s Profile Pic"&gt;
  @endif
  </code></pre>
  
  <p>I need to check if a file exists with the same name as the user-name of a user (uploads create a file with that name in the above specified location).The false is where the condition for file existence should be but i'm facing 2 problems that i haven't found in other solutions:</p>
  
  <ol>
  <li><p>The file exists in a path outside of storage. (it exists in public
  folder) </p></li>
  <li><p>I want to do it without the use of storage or file facades.</p></li>
  </ol>
  
  <p>Note: Following changes have been made to filesystems.php</p>
  
  <pre><code>'local' =&gt; [
              'driver' =&gt; 'local',
              'root' =&gt; storage_path('../public/img/uploads/'),
          ]
  </code></pre>
  
  <p>Edit: The problem is similar to the one mentioned here but this solution didn't work for me:<a href="https://stackoverflow.com/questions/34028575/determining-if-a-file-exists-in-laravel-5">Determining If a File Exists in Laravel 5</a></p>
  
  <p>Edit#2:
  Final Working Code:</p>
  
  <pre><code>@if(is_file("img/uploads/avatars/{$user-&gt;Uname}"))
  &lt;img src="img/uploads/avatars/{{$user-&gt;Uname}}" class="img-thumbnail" alt="{{$user-&gt;Uname}}'s Profile Pic"&gt;
  @else
  &lt;img src="img/uploads/avatars/default.jpg" class="img-thumbnail" alt="{{$user-&gt;Uname}}'s Profile Pic"&gt;
  @endif
  </code></pre>