I would like to use an inline livewire component for guest and app pages. By default, I understand that livewire reverts back to layout.app
and I know you can update the default layout for all full page renders.
I am reading this docs https://laravel-livewire.com/docs/2.x/rendering-components and was able to get it working with regular approach of just having blade
and .PHP
file.
public function render()
{
return <<<'HTML'
<div>
example page view
</div>
HTML;
}
Is it possible to do this thing from the docs in an inline component where we return the HTML directly?
public function render()
{
return view('livewire.show-posts')
->layout('layouts.guest');
}
public function render()
{
return <<<'HTML'
<div>
example page view
</div>
HTML; ->layout('layouts.guest'); // something along the lines of this
}
CodePudding user response:
No it's not possible. You have to use view()->layout() arrow function
CodePudding user response:
maybe you can use it this way:
public function render()
{
$datas = [
'data' => 'example page view'
];
return view('livewire.show-posts', $data)
->layout('layouts.guest');
}