Home > OS >  Laravel blade section and yield. yield does not work well
Laravel blade section and yield. yield does not work well

Time:12-18

I am a biginner of Laravel blade.

I wanted to split index.blade.php. When the contents of morumoru.blade.php modal.blade.php are on index.html.it works well.

/view/camila/cabelo/index.blade.php

@yield('camila.cabelo.morumoru')

<button type="button"  data-toggle="modal" data-target="#exampleModalCenter">
SAMPLE
</button>

@yield('camila.cabelo.blade')

/view/camila/cabelo/morumoru.blade.php

@section('morumoru.blade')

<ul>
    <li><a href="/star">INDEX</a></li>
    <li><a href="/star/sun">SUN</a></li>
    <li><a href="/star/moon">MOON</a></li>
</ul>

@endsection

/view/camila/cabelo/modal.blade.php

@section('modal')
<!-- Modal -->
  <div  id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
    <div  role="document">
      <div >
        <div >
          <h5  id="exampleModalCenterTitle">...</h5>
          <button type="button"  data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div >
          ...
        </div>
        <div >
          <button type="button" >OK</button>
        </div>
      </div>
    </div>
  </div>


@endsection

CodePudding user response:

use @include('camila.cabelo.morumoru') and @include('camila.cabelo.modal') instead of @yield

CodePudding user response:

use include instead of yield, and remove @section also @endsection from blade files

Top include like this @include('camila.cabelo.morumoru') Bottom include like this @include('camila.cabelo.modal')

  • Related