-1
I have a problem here I need to send a variable to my layout, I tried so:
On the controller
$this->layout->page = 'Atendentes';
and in the layout that
@yield('page')
the problem is that I need to compare this page variable within an if that in case is:
@if ( @yield('page') == 'Atendentes' )
//do something
@endif
but it embarrasses the php tags, it returns me an error with the code like this:
<?php if ( <?php echo $__env->yieldContent('page') == 'Atendentes' ); ?>: ?>
Try
@if ($page == 'Atendentes' )
.– gmsantos
he does not find the variable
– tissei
Errorexception Undefined variable: page
– tissei
Ah, you are passing the variable through the layout. Try passing this variable in the View::make call of your method as array in the second argument:
View::make('path.do.view', [ 'page' => 'Atendentes'])
– gmsantos
so I’m passing the variable to my layout, if I go through the view it goes only to the view is not accessible in the layout
– tissei