{{--Include a view if it exists --}}@includeIf('sidebars.admin', ['some'=>'data']){{--Include a view if a passed variable is truth-y --}}@includeWhen($user->isAdmin(),'sidebars.admin', ['some'=>'data']){{--Include the first view that exists from a given array of views --}}@includeFirst(['customs.header','header'], ['some'=>'data'])
@each
有些情况你希望循环include某些模板,这就是@each要干的事.
假设我们有一个由模块组成的侧边栏,我们希望包含多个模块,每个模块都有不同的标题。请看示例4-12
Example 4-12. Using view partials in a loop with @each