Laravel - Check if @yield empty or not

后端 未结 17 2206
醉梦人生
醉梦人生 2021-01-31 02:08

Is it possible to check into a blade view if @yield have content or not?

I am trying to assign the page titles in the views:

@section(\"title\", \"hi wor         


        
17条回答
  •  别跟我提以往
    2021-01-31 02:32

    For those looking on it now (2018+), you can use :

    @hasSection('name')
       @yield('name')
    @endif
    

    See : https://laravel.com/docs/5.6/blade#control-structures

提交回复
热议问题