Laravel 5.2 method to check is view exists? Laravel 5.2 method to check is view exists? laravel laravel

Laravel 5.2 method to check is view exists?


Yes, an exists() method is available.

if(view()->exists($view)){    return view($view)->render();}return "Page tidak ditemukan";


Yes. Using the View facade.

// Return true when welcome.blade.php does not exist in theview folderView::exists('welcome'); // Return false when login.blade.php does not exist in the view folderView::exists('login');


    try {          return view($view);    } catch (\Exception $e) {        return "Page tidak ditemukan";    }

will be more efficient way