Custom query for repeater

Hi everyone. Is it possible to create custom query for repeater?
4 Replies
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
AlexAnder
AlexAnder15mo 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 Harrin15mo ago
maybe you need a repeater within a repeater your code wont work because all the repeaters have the same name
AlexAnder
AlexAnder15mo 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..