Laravel 5.2 method to check is view exists?
try {
return view($view);
} catch (\Exception $e) {
return "Page tidak ditemukan";
}
will be more efficient way
Yes. Using the View
facade.
// Return true when welcome.blade.php does not exist in theview folder
View::exists('welcome');
// Return false when login.blade.php does not exist in the view folder
View::exists('login');
Yes, an exists() method is available.
if(view()->exists($view)){
return view($view)->render();
}
return "Page tidak ditemukan";