Custom query for repeater

Hi everyone. Is it possible to create custom query for repeater?
4 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
AlexAnder
AlexAnderOP2y ago
I try something like this. Is it suppose to be like that?
//...
foreach ($record->categories as $category) {
Repeater::make('answers')
->relationship('answers', fn () => Category::find($category->id)->answers())
->schema([
//...
//...
foreach ($record->categories as $category) {
Repeater::make('answers')
->relationship('answers', fn () => Category::find($category->id)->answers())
->schema([
//...
Dan Harrin
Dan Harrin2y ago
maybe you need a repeater within a repeater your code wont work because all the repeaters have the same name
AlexAnder
AlexAnderOP2y ago
Strange, I made
foreach ($record->categories as $key => $category) {
Repeater::make($key)
->relationship('categories', fn () => $category->answers()->where('survey_id', $record->id)->orderBy('question_order_by'))
->schema(
// ...
foreach ($record->categories as $key => $category) {
Repeater::make($key)
->relationship('categories', fn () => $category->answers()->where('survey_id', $record->id)->orderBy('question_order_by'))
->schema(
// ...
and it works. But it's lazy load..
Want results from more Discord servers?
Add your server