gpt4 book ai didi

php - Laravel Blade : Can you yield a default partial

转载 作者:IT王子 更新时间:2023-10-29 00:06:00 26 4
gpt4 key购买 nike

如果我在 Laravel Blade 中有一个名为 RightSideBar.blade.php 的布局,一个区域 yield('content') 和另一个yield('sidebar')

如果扩展 RightSideBar 的 View 没有 section('sidebar')?

我知道你可以通过 default 传递一个,只是想知道是否有办法将默认设置为部分。

最佳答案

是的,你可以传递一个默认值

documentation

@yield('sidebar', '默认内容');

当子模板没有 @section('sidebar')

关于php - Laravel Blade : Can you yield a default partial,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24549650/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com