T
T
th1s2016-03-27 23:00:43
Laravel
th1s, 2016-03-27 23:00:43

How to load 2 templates in Laravel?

Tell me how you can load 2 templates with 2 controllers at once?

get('/', ['as' => 'classic', 'uses' => '[email protected]']);
get('/', ['as' => 'fast', 'uses' => '[email protected]']);

both need to be loaded.
<div id="classic">
    @yield('content')
  </div>

  <div id="fast" style="display: none">	
   @yield('content2')
  </div>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Kuznetsov, 2016-03-27
@dima9595

If I'm not mistaken, then no way.

O
OnYourLips, 2016-03-28
@OnYourLips

You create another controller method in which you get the necessary data and give it to the desired template.

D
Dmitry, 2016-03-28
@Astatroth

In the main template, write @include('content2') where necessary, use the composer to prepare data for this template .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question