TC
Twill CMS15mo ago
Dakaa

How to make inline repeater's content show up in preview/revision mode?

Client facing website;
No description
11 Replies
Dakaa
DakaaOP15mo ago
But on admin preview mode:
No description
ifox
ifox15mo ago
How is your repeater stored? JSON? HasMany relationship? How are you accessing it when rendering your frontend?
Dakaa
DakaaOP15mo ago
the block's code resources/views/components/twill/blocks/header.blade.php:
@foreach($block->children()->get()->where('child_key', 'menu-item') ?? [] as $child)
@foreach($block->children()->get()->where('child_key', 'menu-item') ?? [] as $child)
ifox
ifox15mo ago
remove parenthesis after children
Dakaa
DakaaOP15mo ago
ifox
ifox15mo ago
And ->get()
Dakaa
DakaaOP15mo ago
let me try
Dakaa
DakaaOP15mo ago
No description
Dakaa
DakaaOP15mo ago
Perfect, thankyou! TIL
ifox
ifox15mo ago
in the preview relationship are hydrated, so if you add parenthesis Laravel makes a query in the database instead of using already loaded relationships
Dakaa
DakaaOP15mo ago
i see it now, i dd()'ed both @ifox.dev thankyou once again
Want results from more Discord servers?
Add your server