You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`where(string $field, mixed $value = null): static`|Nested only. Keeps rows where `$field` matches `$value`: strings match as exact text (`'0e12'` never matches `'0e99'`), numbers match numerically in either direction (`'1'` matches 1, 1 matches `'1.00'`), null matches only null (SQL IS NULL), bools compare as 1/0 on either side. Smart args unwrap. Rows without the field are dropped. Chain calls for AND. Warns when `$field` is missing from the first row. Single-arg `where($field)` keeps rows where the field is non-empty (PHP `empty()` rule: NULL, false, 0, "0", "", missing are empty). NOTE: `where($f)` and `where($f, null)` differ - the latter matches only stored NULLs |
247
-
|`whereNot(string $field, mixed $value = null): static`|Nested only. Drops rows where `$field` matches `$value` (same matching rules as `where()`); rows WITHOUT the field are kept. Single-arg `whereNot($field)` keeps rows where the field is empty or missing (exact complement of `where($field)`) |
248
-
|`whereInList(string $field, mixed $value): static`|Nested only. Keeps rows where tab-separated `$field` contains `$value` as a whole value (`"\tmenu\tfooter\t"` format, CMS Builder checkbox/multi-select fields) or equals it as a plain single value. Never substring matching |
246
+
|`where(string $field, mixed $value = null): static`|Rows only. Keeps rows where `$field` matches `$value`: strings match as exact text (`'0e12'` never matches `'0e99'`), numbers match numerically in either direction (`'1'` matches 1, 1 matches `'1.00'`), null matches only null (SQL IS NULL), bools compare as 1/0 on either side. Smart args unwrap. Rows without the field are dropped. Chain calls for AND. Warns when `$field` is missing from the first row. Single-arg `where($field)` keeps rows where the field is non-empty (PHP `empty()` rule: NULL, false, 0, "0", "", missing are empty). NOTE: `where($f)` and `where($f, null)` differ - the latter matches only stored NULLs |
247
+
|`whereNot(string $field, mixed $value = null): static`|Rows only. Drops rows where `$field` matches `$value` (same matching rules as `where()`); rows WITHOUT the field are kept. Single-arg `whereNot($field)` keeps rows where the field is empty or missing (exact complement of `where($field)`) |
248
+
|`whereInList(string $field, mixed $value): static`|Rows only. Keeps rows where tab-separated `$field` contains `$value` as a whole value (`"\tmenu\tfooter\t"` format, CMS Builder checkbox/multi-select fields) or equals it as a plain single value. Never substring matching |
249
249
|`filter(?callable $callback = null): static`| Both shapes. Callback receives raw `($value, $key)`, keeps on true. No callback: removes falsy (`""`, `"0"`, 0, null, false). Keys preserved like `array_filter()` - chain `values()` for a clean JSON array |
|`sortBy(string $field, int $flags = SORT_REGULAR): static`|Nested only. Ascending by `$field`; rows missing the field sort first (like MySQL ORDER BY) and are kept unchanged. Numeric row keys renumber, string keys preserved. `SORT_NATURAL` for human number order; `SORT_ASC`/`SORT_DESC` throw |
251
+
|`sortBy(string $field, int $flags = SORT_REGULAR): static`|Rows only. Ascending by `$field`; rows missing the field sort first (like MySQL ORDER BY) and are kept unchanged. Numeric row keys renumber, string keys preserved. `SORT_NATURAL` for human number order; `SORT_ASC`/`SORT_DESC` throw |
252
252
|`unique(): static`| Flat only. Removes duplicates keeping the first, keys preserved; compares as strings (`array_unique()`), so 1 and `'1'` are duplicates |
253
253
254
254
## Transforming and Grouping
255
255
256
+
"Rows only" and "Flat only" carry the same contract as in Filtering and
|`column(int\|string\|null $columnKey, int\|string\|null $indexKey = null): static`| Like `array_column()`: one field per row; `$indexKey` keys results by another field using `indexBy()` rules (missing field keys under `''`, floats throw, bools key as 1/0); `column(null, $indexKey)` keys whole rows, same as `indexBy()`|
259
-
|`columnAt(int $index): static`| The column at a position from each row, ignoring key names (0 first, -1 last)|
260
-
|`indexBy(string $field): static`| Whole rows keyed by `$field`; duplicate keys keep the LAST row. Null/missing field keys under `''`; floats throw (convert to strings first), booleans key as 1/0 |
261
-
|`groupBy(string $field): static`| Rows grouped by `$field`: one child collection per distinct value; same keying rules as `indexBy()`|
261
+
|`column(int\|string\|null $columnKey, int\|string\|null $indexKey = null): static`|Rows only. Like `array_column()`: one field per row; `$indexKey` keys results by another field using `indexBy()` rules (missing field keys under `''`, floats throw, bools key as 1/0); `column(null, $indexKey)` keys whole rows, same as `indexBy()`|
262
+
|`columnAt(int $index): static`|Rows only. The column at a position from each row, ignoring key names (0 first, -1 last) |
263
+
|`indexBy(string $field): static`|Rows only. Whole rows keyed by `$field`; duplicate keys keep the LAST row. Null/missing field keys under `''`; floats throw (convert to strings first), booleans key as 1/0 |
264
+
|`groupBy(string $field): static`| Rows only. Rows grouped by `$field`: one child collection per distinct value; same keying rules as `indexBy()`|
262
265
|`keys(): static`| The keys as a new collection (encode on output in HTML mode) |
263
266
|`values(): static`| The values, keys renumbered from 0 |
264
267
|`map(callable $callback): static`| New collection from `$callback` per element: closures receive raw `($value, $key)`, PHP built-ins receive `$value` only; rows arrive as plain arrays; returned arrays become rows again |
0 commit comments