Support the ongoing development of →
posted 7 years ago
Last updated 2 years ago.

just replace @endsection with @stop, i think that would be helpful for you


Get the clear idea on template inheritance

You need to understand how blade template inheritance work. Take some time, and read this awesome documentation!

Here is a good explanation:

├─── main.blade.php [Parent layout, with @yield]
│         └─── section.blade.php   [This is the children, with @section]
│         └─── otherfile.blade.php  [This is another children, @section]

Remember, when using @yield, it always return empty if you access the file directly as view. It is special made for children. Just like you give a baby formulated milk, you don't drink it, your baby does! Thus, access it ONLY with children when using @yield and @section

How to deal with it?

In your router, you have to set the view as

    public function section(){
	    return view('section.blade.php');

Extra Tips - Using @include:

@include guide

If you want to view the parent instead, and include the children inside it, feel free to use @include tag as follow in your parent template file.


├─── main.blade.php [Parent layout, with @include('section')]
│         └─── section.blade.php   [This is the children to be included]
│         └─── otherfile.blade.php  [This is another children]

Last updated 7 years ago.

Sign in to participate in this thread!


Your banner here too?

superrupe superrupe Joined 27 Sep 2016


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.