From the Laravel docs, you can include \'sections\' inside layouts using two methods:
@section(\'sidebar\')
Thi
This line clears out the confusion: "Note that views which extend a Blade layout simply override sections from the layout. Content of the layout can be included in a child view using the @parent
directive in a section".
So, if you already have a @section
defined in the master layout, it will be overriden unless you specify @parent
inside the child layout's @section
.
But for @yield
, it always gets the section from the child layout. That means it always overrides the @yield
part, even if it has a default defined as @yield('section', 'Default Content')
.
I hope that clears your confusion. Let me know if you have more questions. Thanks