I can not access the shared variable inside the new render function between @php and @endphp directives. Let me demonstrate with the next two examples of code
// The code example that @nunomaduro uses
<?php
use function \Laravel\Folio\render;
render( function($view) {
$post = ['title' => 'Welcome Render Method!'];
return $view->with('post', $post);
});
?>
// The value of `title` is printed out successfully
<?php echo $post['title']; ?>
But when I use the previous code between @php and @endphp directives the Undefined variable $post error is triggered
@php
use function \Laravel\Folio\renderWhen;
renderWhen(true, function($view) {
$post = ['title' => 'Welcome Render Method!'];
return $view->with('post', $post);
});
@endphp
@dd($post);
Folio Version
1.1.0
Laravel Version
^10.10
PHP Version
^8.1
Description
I can not access the shared variable inside the new
render
function between@php
and@endphp
directives. Let me demonstrate with the next two examples of codeBut when I use the previous code between
@php
and@endphp
directives the Undefined variable $post error is triggeredSteps To Reproduce
NULL