mirror of
https://github.com/alexjustesen/speedtest-tracker.git
synced 2026-06-23 04:10:25 +00:00
This commit is contained in:
@@ -28,7 +28,7 @@ class ResultsController extends ApiController
|
||||
);
|
||||
}
|
||||
$validator = Validator::make($request->all(), [
|
||||
'per_page' => 'integer|min:1|max:500',
|
||||
'page.size' => 'integer|min:1|max:'.config('json-api-paginate.max_results'),
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
@@ -65,7 +65,7 @@ class ResultsController extends ApiController
|
||||
'created_at',
|
||||
'updated_at',
|
||||
])
|
||||
->jsonPaginate($request->input('per_page', 25));
|
||||
->jsonPaginate();
|
||||
|
||||
return ResultResource::collection($results);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class ResultsAnnotations
|
||||
parameters: [
|
||||
new OA\Parameter(ref: '#/components/parameters/AcceptHeader'),
|
||||
new OA\Parameter(
|
||||
name: 'per_page',
|
||||
name: 'per.page',
|
||||
in: 'query',
|
||||
required: false,
|
||||
schema: new OA\Schema(type: 'integer', minimum: 1, maximum: 500, default: 25),
|
||||
|
||||
@@ -47,7 +47,7 @@ use OpenApi\Attributes as OA;
|
||||
)
|
||||
),
|
||||
new OA\Property(property: 'path', type: 'string'),
|
||||
new OA\Property(property: 'per_page', type: 'integer'),
|
||||
new OA\Property(property: 'per.page', type: 'integer'),
|
||||
new OA\Property(property: 'to', type: 'integer'),
|
||||
new OA\Property(property: 'total', type: 'integer'),
|
||||
],
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
* The maximum number of results that will be returned
|
||||
* when using the JSON API paginator.
|
||||
*/
|
||||
'max_results' => env('API_MAX_RESULTS', 500),
|
||||
|
||||
/*
|
||||
* The default number of results that will be returned
|
||||
* when using the JSON API paginator.
|
||||
*/
|
||||
'default_size' => 25,
|
||||
|
||||
];
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
"$ref": "#/components/parameters/AcceptHeader"
|
||||
},
|
||||
{
|
||||
"name": "per_page",
|
||||
"name": "per.page",
|
||||
"in": "query",
|
||||
"description": "Number of results per page",
|
||||
"required": false,
|
||||
|
||||
Reference in New Issue
Block a user