TC
Twill CMS16mo ago
Dakaa

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

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