I have a layouts/app.blade.php
view where I yield a content section.
layouts/app.blade.php
@yield('content')
adminpanel/adminpanel.blade.php
@extends('layouts.app')
@section('content')
<div id="wrapper">
<div id="sidebar-wrapper">
@yield('sidebar')
</div>
<div id="page-content-wrapper">
<div class="container-fluid">
@yield('page-content')
</div>
</div>
</div>
@endsection
adminpanel/sidebar.blade.php
@extends('adminpanel.adminpanel')
@section('sidebar')
<ul class="sidebar-nav">
<li class="sidebar-brand">
<a href="#">
Profile
</a>
</li>
<li>
<a href="#">Dashboard</a>
</li>
<li>
<a href="#">News</a>
</li>
</ul>
@endsection
Am I doing something wrong here?
When I type something in the adminpanel/adminpanel.blade.php
view it works but the yielding of partials doesn't work.
If you are returning the "adminpanel/adminpanel", then you must include the sidebar from the admin-panel, not "yield" something for what you don't have the contents.
@include('adminpanel.sidebar')
instead of
@yield('page-content')
and then in your sidebar, remove all blade directives because they are no longer needed.
<ul class="sidebar-nav">
<li class="sidebar-brand">
<a href="#">
Profile
</a>
</li>
<li>
<a href="#">Dashboard</a>
</li>
<li>
<a href="#">News</a>
</li>
</ul>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With