使用laravel的布局排除某些部分

Ale*_*ong 4 php laravel

我有一个布局刀片文件 @include('footer')

但在一页中我遇到了这个问题:我想扩展该布局但不想包含页脚。

所以我该怎么做?有什么方法可以检查我的 layout.blade.php 中使用布局文件的页面吗?

小智 8

您可以在布局中定义一个部分:

@section('footer')
    @include('footer')
@show
Run Code Online (Sandbox Code Playgroud)

然后在一个视图中覆盖它:

@section('footer')
{{-- this section will be empty --}}
@stop
Run Code Online (Sandbox Code Playgroud)