Laravel template output not working

I have a layouts/app.blade.php where I provide 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 print something in the adminpanel/adminpanel.blade.php , this works, but the assignment of partial actions does not work.

+5
source share
2 answers

If you are returning "adminpanel / adminpanel", then you should enable the sidebar from the admin panel and not "give in" to something for which you have no content.

 @include('adminpanel.sidebar') 

instead

 @yield('page-content') 

and then in the sidebar, remove all blade server 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> 
+4
source

try to enable adminpanel /adminpanel.blade.php

 @extends('layouts.app') @section('content') <div id="wrapper"> <div id="sidebar-wrapper"> @include('adminpanel.sidebar') </div> <div id="page-content-wrapper"> <div class="container-fluid"> @yield('page-content') </div> </div> </div> @endsection 
+2
source

Source: https://habr.com/ru/post/1274057/


All Articles