AppleForTheKing
AppleForTheKing

Reputation: 105

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?

Upvotes: 1

Views: 1285

Answers (2)

Jeff
Jeff

Reputation: 166

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 :)

Upvotes: 0

pseudoanime
pseudoanime

Reputation: 1593

Please read though https://laravel.com/docs/5.4/blade#extending-a-layout, I don't think you've defined your yields and sections properly.

I don't exactly know what you're trying to implement, but * think you should change @yield('section') to @yield('wrapper') and also add @endsection to the view.

Upvotes: 1

Related Questions