//Function will check if image exist then returned the passed image otherwise return the default image
function checkImage($path = '', $placeholder = '')
{
if (empty($placeholder)) {
$placeholder = 'placeholder.png';
}
if (!empty($path)) {
$url = explode('storage', $path);
$url = public_path() . '/storage' . $url[1];
$isFile = explode('.', $url);
if (file_exists($url) && count($isFile) > 1)
return $path;
else
return asset('img/' . $placeholder);
} else {
return asset('img/' . $placeholder);
}
}