protected function replaceAliases(Builder $query, $aliases)
    {
        foreach ($query->getQuery()->wheres as $key => $value) {
            if (in_array($value['column'], array_keys($aliases))) {
                $query->getQuery()->wheres[$key]['column'] = $aliases[$value['column']];
            }
        }
    }
protected function replaceAliases(Builder $query, $aliases)
    {
        foreach ($query->getQuery()->wheres as $key => $value) {
            if (in_array($value['column'], array_keys($aliases))) {
                $query->getQuery()->wheres[$key]['column'] = $aliases[$value['column']];
            }
        }
    }
protected function replaceAliases ( Builder $ query , $ aliases ) { foreach ( $ query -> getQuery ( ) -> wheres as $ key => $ value ) { if ( in_array ( $ value [ 'column' ] , array_keys ( $ aliases ) ) ) { $ query -> getQuery ( ) -> wheres [ $ key ] [ 'column' ] = $ aliases [ $ value [ 'column' ] ] ; } } }
Replace aliases in where statement with sub queries.

@param Builder $query
@param array   $aliases

@return void
Replace aliases in where statement with sub queries .