Check if a view exists and do an @include in Laravel Blade

后端 未结 2 980
余生分开走
余生分开走 2021-02-08 02:48

With Laravel Blade, is there an elegant way to check if a view exists before doing an @include?

For example I\'m currently doing this:

@if(V         


        
2条回答
  •  醉酒成梦
    2021-02-08 03:44

    Had a similar issue. Turns out that from Laravel 5.3 there is an @includeIf blade directive for this purpose.

    Simply do @includeIf('some-view')

提交回复
热议问题