A
A
axblue2017-01-10 23:57:54
Laravel
axblue, 2017-01-10 23:57:54

How to get the variables of the main template when displaying the child?

Hello. Tell. There are layouts, let's say a cabinet of such a structure:

<div id="user-dashboard" class="row">
        <aside id="left-sidebar" class="col s12 m3 l2">
            @include('includes.user-left-sidebar')
        </aside>
        <div id="content" class="col s12 m9 l7">
            <div class="row">
                @yield('content')
            </div>
        </div>
        <aside id="right-sidebar" class="col s12 m3 l3">
            @include('includes.user-right-sidebar')
        </aside>
    </div>

The left and right sidebar will always have the same data, only the content will change. Let's say the address user/page1 is loaded only content, then user/page2 is also loaded only content. Is it possible to somehow pass variables in one place only for the main template, that is, sidebars, and already with the user/page1, user/page2 route handler, get only the content?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pantagruel964, 2017-01-11
@leshikgo

https://laravel.com/docs/5.3/blade#including-sub-views

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question