多个@ yield / @部分时刀片 - (Sage 9)问题

We are new to sage9 / Blade framework and we are trying to create a template logic with ACF. Everything was working well with 1 block but when we add more block the first 1 echoes 2-3 times.

Here's how we did it:

We use the default layouts.app from sage9:

web/app/themes/[theme-name]/resources/views/layouts/app.blade.php

...
    <div class="vy_main uk-offcanvas-content">
      <header>
        @yield('dispatch_banner') 
      </header>
      <div class="wrap container" role="document">
        <div class="content">
          <main class="main">
            @yield('dispatch') //The one we currently working on
          </main>
...

In the layout we are calling @yield('dispatch'). Inside page.blade.php we are extending the layouts and we add the dispatch section.

web/app/themes/[theme-name]/resources/views/page.blade.php

@extends('layouts.app')

@section('dispatch_banner')
  @layouts('banners')
      {!! App::banners() !!} 
  @endlayouts
@endsection


@section('dispatch')
  @layouts('sections')
      {!! App::sections() !!} //This call a controller where we can select the correct section to display.
  @endlayouts
@endsection

Inside the controller, web/app/themes/[theme-name]/app/Controllers/App.php we return a template to use and passing configurations/variables to use. :

public static function sections(){
 ...
   $return .= \App\template('sections.'.$sections, $config);
  }

  return $return;
 ...
}

We create a standard block. This block include by the dispatcher :

web/app/themes/[theme-name]/resources/views/sections/std.blade.php

Inside this template, we created a new layouts "base", because all sections will have the same base structure, we extend this base inside the template and put a section content in it like so:

web/app/themes/[theme-name]/resources/views/sections/std.blade.php

@extends('layouts.base')

@section('section-content')
  @if ($image)
    <div class="uk-grid uk-flex-middle" data-uk-grid>
      <div class="{!! $class_image !!}">
          <img src="{!! $image['url'] !!}" alt="{!! $image['alt'] !!}">
      </div>
      <div class="{!! $class_content !!}">
  @endif 
      <div class="{!! $content_class_content !!}">
          @layouts('content')
            {!! App::content() !!}
          @endlayouts
      </div>

  @if ($image)  
      </div>
    </div>
  @endif 
@endsection

And here the layout web/app/themes/[theme-name]/resources/views/layouts/base.blade.php

<section {{ (( $section_id )?'id='.$section_id:'') }} class="{!! $class_section !!}">

  @if($has_container)
    <div class="uk-container uk-container-{!! $container !!}" data-uk-scrollspy="cls: uk-animation-fade;"> 
      @yield('section-content')
    </div>
  @else 
    @yield('section-content')
  @endif

</section>

As I said, everything was working fine with 1 block but as soon as we add a second block the data just keep repeating BUT only the @yield('section-content') from the base, the variables use inside the layout aren't repeating.

Here what we have in the html from :

<section {{ (( $section_id )?'id='.$section_id:'') }} class="{!! $class_section !!}">

We get :

<section class="uk-section vy_std uk-section-primary uk-section-xlarge">
<section class="uk-section vy_accordion uk-section-transparant">
<section class="uk-section vy_std uk-section-transparant">

Where is the problem with our logic and we the content from @yield('section-content') keep repeating instead of using the right data send from the controller?

If this can help I can send all the code from the controller, it's not big but to me it's wasn't where the problem is so I cut this part out.

Thank for your time!

I manage to work this out by using components/slots instead of layouts. Now I get the base from a component like so:

@component('layouts.base', $config)
  /*Section code*/
@endcomponent

And everything is working again!