Search code examples
phplaravellaravel-5laravel-5.3

Laravel: yield('content')


I created a view:

@extends('layouts.dashboard')
@section('wrapper')

<table class="table table-striped">
  <tr>
    <th>Username</th>
    <th>Event-count</th>
    <th>Is active</th>
  </tr>

And: layouts.dashboard

<div class="main-panel">
    @yield('section')
</div>
            <footer class="footer">

And now the table is shown on top and not in the div class="main". Does anyone know why?


Solution

  • Here

    @extends('layouts.dashboard')
    @section('wrapper')
    
    <table class="table table-striped">
        <tr>
            <th>Username</th>
            <th>Event-count</th>
            <th>Is active</th>
        </tr>
    </table>
    @endsection
    

    And: layouts.dashboard

    <div class="main-panel">
        @yield('wrapper')
    </div>
    

    That should do the job... Let me know if this works for you :)