Laravel - Return values in master layout

0

I have an application using laravel 5.5, there was a need to insert a dynamic field in the footer that is located in the master layout, but I am not able to return the data in it, I could not find a solution to my problem. p>

The main route is configured to receive the view home, set in the controller to send the data to view, in this view I can see the data correctly but only in it, but now I need to see the same data in the footer of the page and would need it basically insert this section in the footer to receive the values.

<?php
for ($i=0; $i < $maiorTamanho; $i++) {
  echo '<tr>';
    if(sizeof($dataTim) > $i)
    {
      echo '<td>'. $dataTim[$i]->numero .'</td>';
    }
    else {
      echo '<td></td>';
    }

    if(sizeof($dataVivo) > $i)
    {
      echo '<td>'. $dataVivo[$i]->numero .'</td>';
    }
    else {
      echo '<td></td>';
    }

    if(sizeof($dataClaro) > $i)
    {
      echo '<td>'. $dataClaro[$i]->numero .'</td>';
    }
    else {
      echo '<td></td>';
    }

    if(sizeof($dataOi) > $i)
    {
      echo '<td>'. $dataOi[$i]->numero .'</td>';
    }
    else {
      echo '<td></td>';
    }
  echo '</tr>';
}
?>

What do I need to do to return the values in the master layout?

    
asked by anonymous 09.02.2018 / 15:21

1 answer

0

Returning some data specifically for the "master" layout is not possible.

One of the solutions would be to instantiate the direct model in the view.

For example:

@foreach(\Auth::user()->notifications()->orderby('id', 'desc')->limit(10)->pluck('data') as $notification)
    <li>
         <a>
             <span class="bold">
                 <span>
                      {{$notification[0]['title']}}
                 </span>
             </span>
             <br>
             <span class="message">
                 {!! $notification[0]['message'] !!}
             </span>
          </a>
     </li>
@endforeach
    
20.02.2018 / 21:16