Add pagination for participant api index parent
This commit is contained in:
parent
646b292249
commit
e9e8b193f4
|
@ -37,7 +37,7 @@ class ParticipantIndexAction
|
|||
|
||||
$data = match ($parent) {
|
||||
null => $this->handle($form, $filter),
|
||||
-1 => $this->getQuery($form, $filter)->where('parent_id', null)->get(),
|
||||
-1 => $this->getQuery($form, $filter)->where('parent_id', null)->paginate(15),
|
||||
default => $this->getQuery($form, $filter)->where('parent_id', $parent)->get(),
|
||||
};
|
||||
|
||||
|
|
|
@ -195,7 +195,8 @@ class ParticipantIndexActionTest extends FormTestCase
|
|||
|
||||
$this->callFilter('form.participant.index', [], ['form' => $form, 'parent' => -1])
|
||||
->assertJsonPath('data.0.children_count', 2)
|
||||
->assertJsonPath('data.1.children_count', 0);
|
||||
->assertJsonPath('data.1.children_count', 0)
|
||||
->assertJsonPath('meta.current_page', 1);
|
||||
$this->callFilter('form.participant.index', [], ['form' => $form, 'parent' => $participant->id])->assertJsonPath('data.0.children_count', 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue