F
F
Flasher2017-05-02 18:02:20
Laravel
Flasher, 2017-05-02 18:02:20

On all pages, @yield doesn't output anything. How to share data between pages in a blade?

Once again I will try to ask a question in more detail. On all pages except layouts/app.blade.php these blocks are empty. Why? How to share yield to all pages, not just the one where I include the view.

<li>
    @yield('fresh_comments')
    @yield('news_month')
    @yield('news_random')
</li>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
den-masonov, 2017-05-02
@Flasher

Maybe you didn't specify the @extends directive in the included file? With an indication not of layouts/app.blade.php, but of the file where the yield was put.
If it does not work, then I think the @include directive will help solve the problem.

A
Andrzej Wielski, 2017-05-02
@wielski

Why do you need yield anywhere other than the main template?
Describe the problem in more detail, perhaps there is a more correct and elegant solution?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question