Reputation: 554
I have a package in my Laravel project which simply displays text from the package blade view. All I do is publish the package view to my project's main view so that I could include the package view's text in my main view by the use of @include() method. How can I add a condition to check whether the package exists or is included in my project before I call its view?
Upvotes: 2
Views: 1966
Reputation: 17708
You can do it using exists()
as:
if (view()->exists("package.view_name")) {
// do some cool stuffs
}
Upvotes: 1