Skip to content

Commit f576488

Browse files
authored
Merge pull request #5503 from Laravel-Backpack/add-a-way-to-limit-entries
Validate length parameter server side
2 parents 648c417 + 05ee35c commit f576488

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/app/Http/Controllers/Operations/ListOperation.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ public function search()
7979
$length = (int) request()->input('length');
8080
$search = request()->input('search');
8181

82+
// check if length is allowed by developer
83+
if ($length && ! in_array($length, $this->crud->getPageLengthMenu()[0])) {
84+
return response()->json([
85+
'error' => 'Unknown page length.',
86+
], 400);
87+
}
88+
8289
// if a search term was present
8390
if ($search && $search['value'] ?? false) {
8491
// filter the results accordingly

0 commit comments

Comments
 (0)