How to check View Exists or not in Laravel?

Today now in this post i would like to share with you How to check if View Exists or not in Laravel. In some times we are facing this situations, we need to check if view exists then show view page otherwise it will display something else. But we can perform this task by using “exists” function of view helper.

So It will return us true or false. So we can use the bellow example.

Example:
if (view()->exists('users.index')) {
    ....
}

Read Also : How to convert Object into Array in PHP?

Thanks for read. I hope it help you. For more you can follow us on facebook.

About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →