TC
Twill CMS14mo ago
Dakaa

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

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