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

Client facing website;
No description
11 Replies
Dakaa
DakaaOP3y ago
But on admin preview mode:
No description
ifox
ifox3y ago
How is your repeater stored? JSON? HasMany relationship? How are you accessing it when rendering your frontend?
Dakaa
DakaaOP3y 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
ifox3y ago
remove parenthesis after children
ifox
ifox3y ago
And ->get()
Dakaa
DakaaOP3y ago
let me try
Dakaa
DakaaOP3y ago
No description
Dakaa
DakaaOP3y ago
Perfect, thankyou! TIL
ifox
ifox3y 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
DakaaOP3y ago
i see it now, i dd()'ed both @ifox.dev thankyou once again

Did you find this page helpful?