protected function applyForeignKeys($query, $foreignKeys, $filters = array())
    {
        foreach( $foreignKeys as $key ) {
            if( !$this->hasKey( $filters, $key ) ) {
                continue;
            }

            $query = $query->where($key, '=', $filters[ $key ]);
        }

        return $query;
    }
protected function applyForeignKeys($query, $foreignKeys, $filters = array())
    {
        foreach( $foreignKeys as $key ) {
            if( !$this->hasKey( $filters, $key ) ) {
                continue;
            }

            $query = $query->where($key, '=', $filters[ $key ]);
        }

        return $query;
    }
protected function applyForeignKeys ( $ query , $ foreignKeys , $ filters = array ( ) ) { foreach ( $ foreignKeys as $ key ) { if ( ! $ this -> hasKey ( $ filters , $ key ) ) { continue ; } $ query = $ query -> where ( $ key , '=' , $ filters [ $ key ] ) ; } return $ query ; }
Apply various foreign key filters to the query builder. All filters must be applied using the '=' operator.
Filters that require other operators or additional operations such as joins, must be applied in a different way

@param   Builder $query          The query builder that contains all the clauses that have been applied
@param   array $foreignKeys      The list of keys that are identified as foreign keys
@param   array $filters          The filters that are to be applied to the query. The key identifies the database column, the value in the array is the value that is to be matched in the query
@return mixed
Apply various foreign key filters to the query builder . All filters must be applied using the = operator . Filters that require other operators or additional operations such as joins must be applied in a different way