public function filterByRelation($column, $value = null)
    {
        $relations = explode('.', $column);
        $column    = $this->getColumn($column = array_pop($relations), $relations);

        $relations = array_map(function ($relation) {
            return camel_case($relation);
        }, $relations);

        $this->instance->whereHas(implode('.', $relations), function (Builder $builder) use ($column, $value) {
            $value = in_array($value, ['true', 'false']) ? ($value === 'false' ? false : true) : $value;

            is_bool($value)
                ? $builder->where($column, $value)
                : $builder->where($column, $this->getLikeOperator(), "%$value%");
        });

        return $this;
    }
public function filterByRelation($column, $value = null)
    {
        $relations = explode('.', $column);
        $column    = $this->getColumn($column = array_pop($relations), $relations);

        $relations = array_map(function ($relation) {
            return camel_case($relation);
        }, $relations);

        $this->instance->whereHas(implode('.', $relations), function (Builder $builder) use ($column, $value) {
            $value = in_array($value, ['true', 'false']) ? ($value === 'false' ? false : true) : $value;

            is_bool($value)
                ? $builder->where($column, $value)
                : $builder->where($column, $this->getLikeOperator(), "%$value%");
        });

        return $this;
    }
public function filterByRelation ( $ column , $ value = null ) { $ relations = explode ( '.' , $ column ) ; $ column = $ this -> getColumn ( $ column = array_pop ( $ relations ) , $ relations ) ; $ relations = array_map ( function ( $ relation ) { return camel_case ( $ relation ) ; } , $ relations ) ; $ this -> instance -> whereHas ( implode ( '.' , $ relations ) , function ( Builder $ builder ) use ( $ column , $ value ) { $ value = in_array ( $ value , [ 'true' , 'false' ] ) ? ( $ value === 'false' ? false : true ) : $ value ; is_bool ( $ value ) ? $ builder -> where ( $ column , $ value ) : $ builder -> where ( $ column , $ this -> getLikeOperator ( ) , "%$value%" ) ; } ) ; return $ this ; }
Append relation column filter to query builder.

@param array  $column
@param string $value

@return $this
Append relation column filter to query builder .