/** * Filter 检索数据时, 构造此字段的查询 * @param Table $query * @return Table */ public function filter(Table $query) : Table { if (!$this->relation()) { return $query; } return $query->whereEquals($query->original()->getModel()->getKeyName(), $this->getCurrentValue()); }