as($uid); return $this->from( $each )->where(Sql::raw("{$uid}.value"), $value, $operator, $condition, $not); } public function whereJsonKey(string|\Stringable $field, string|null $key, mixed $value, string $operator = Query\Where::OPERATOR_EQUAL, string $condition = Query\Where::CONDITION_AND, bool $not = false) : self { $uid = uniqid("json_"); $extract = Sql::function("json_extract", $field, $key ? "$.$key" : "$"); $each = Sql::function('json_each', $extract)->as($uid); return $this->from( $each )->where(Sql::raw("{$uid}.value"), $value, $operator, $condition, $not); } }