Filtering and Ordering
Resources that support filters accept an associative array through the filters argument, forwarded as-is to the BioTime API as query parameters. Supported filter keys are resource-specific — the SDK doesn't validate them, it passes whatever you provide through to the device, so filters must be supported by the corresponding BioTime API endpoint.
Ordering
Every filterable resource supports an ordering key to control sort order.
Ascending — pass the column name directly:
$employees = $biotime->employees()->list(
filters: ['ordering' => 'first_name'],
);Descending — prefix the column name with -:
$employees = $biotime->employees()->list(
filters: ['ordering' => '-first_name'],
);| Example | Meaning |
|---|---|
ordering => 'first_name' | first_name ASC |
ordering => '-first_name' | first_name DESC |
ordering => 'id' | id ASC |
ordering => '-id' | id DESC |
Documented filters by resource
These are the filter shapes documented in each resource class's PHPDoc (@param array{...} $filters):
| Resource | Filters |
|---|---|
| Employees | emp_code, emp_code_icontains, first_name, first_name_icontains, last_name, last_name_icontains, department, areas, plus ordering |
| Attendances | emp_code, terminal_sn, terminal_alias, plus ordering and the startTime/endTime range parameters |
| Departments | dept_code, dept_name, dept_code_icontains, dept_name_icontains, plus ordering |
| Positions | position_code, position_name, position_code_icontains, position_name_icontains, plus ordering |
| Areas | area_code, area_name, area_code_icontains, area_name_icontains, plus ordering |
| Devices | Not typed in the SDK; any query parameter supported by /iclock/api/terminals/ (e.g. state, ordering) can be passed through filters |
| Resignations | employee (also available via the dedicated findByEmployee() helper), plus any parameter supported by /personnel/api/resigns/ |
TIP
_icontains filters perform a case-insensitive "contains" match; the exact filter, e.g. first_name vs. first_name_icontains, and its behavior, are defined by the BioTime device API itself.
Combining filters
$employees = $biotime->employees()->list(
page: 1,
perPage: 50,
filters: [
'department' => 3,
'areas' => 1,
'ordering' => '-first_name',
],
);Filters work identically with list() and all() — see Pagination for the difference between the two.