/** * Filters a query object with this item's data given a model * * @param Query $query * @param Eloquent $model * * @return void */ public function filterQuery(&$query, $model) { //run the parent method parent::filterQuery($query, $model); //if there is no value, return if (!$this->value) { return; } //if the table hasn't been joined yet, join it if (!Column::isJoined($query, $this->table)) { $query->join($this->table, $model->table() . '.' . $model::$key, '=', $this->table . '.' . $this->column); } $query->where_in($this->table . '.id', is_array($this->value) ? $this->value : array($this->value)); }