title: How to check if a file exists in a url in laravel
body: <pre><code>@if (file_exists(env('BASE_URL_MASTER').$p-&gt;main_image))
  
  &lt;img class="primary-img" src="{{env('BASE_URL_MASTER').$p-&gt;main_image}}" alt="single-product" height="200px" width="400px"&gt;
  
  @else
  &lt;img class="primary-img" src="{{asset($p-&gt;main_image?$p-&gt;main_image:'')}}" alt="single-product" height="200px" width="400px"&gt;
  endif
  </code></pre>
  
  <p>I want to check whether given URL has Image if image is available then <code>@if</code> condition should work. but its not working</p>