Add skip and meta to resource in time entry endpoint

This commit is contained in:
Constantin Graf
2024-09-19 23:49:50 +02:00
committed by Gregor Vostrak
parent 3ee7839ca9
commit a882ec6ca0
5 changed files with 122 additions and 36 deletions

View File

@@ -131,6 +131,11 @@ class TimeEntryIndexRequest extends FormRequest
'min:1',
'max:500',
],
// Skip the first n time entries (default: 0)
'skip' => [
'integer',
'min:0',
],
// Filter makes sure that only time entries of a whole date are returned
'only_full_dates' => [
'string',
@@ -143,4 +148,14 @@ class TimeEntryIndexRequest extends FormRequest
{
return $this->input('only_full_dates', 'false') === 'true';
}
public function getLimit(): int
{
return $this->has('limit') ? (int) $this->validated('limit', 100) : 100;
}
public function getSkip(): int
{
return $this->has('skip') ? (int) $this->validated('skip', 0) : 0;
}
}