For a specific design I need to check in my master blade.php file if a section contains something before doing a @yield() to be able to create some shared div structure (and not write it in every view that need to write in this section) :
<div id="content">
<div class="container-fluid">
<div class="box">
@yield('content')
</div>
<div class="box">
Lorem ipsum....
</div>
</div>
</div>
I read on different topic that I could use this to do so :
@if (trim($__env->yieldContent('content')))
...
@endif
My question is, is there a better way to do it. By better I mean more clean way ? Maybe by extending laravel blade directives to create a @ifSectionNotEmpty(), or somehting else I don't know about ? I just feel weird the other way.
Thanks for your tips.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire