src/SearchableTrait.php
protected function makeJoins(Builder $query)
    {
        foreach ($this->getJoins() as $table => $keys) {
            $query->leftJoin($table, function ($join) use ($keys) {
                $join->on($keys[0], '=', $keys[1]);
                if (array_key_exists(2, $keys) && array_key_exists(3, $keys)) {
                    $join->whereRaw($keys[2] . ' = "' . $keys[3] . '"');
                }
            });
        }
    }
protected function makeJoins(Builder $query)
    {
        foreach ($this->getJoins() as $table => $keys) {
            $query->leftJoin($table, function ($join) use ($keys) {
                $join->on($keys[0], '=', $keys[1]);
                if (array_key_exists(2, $keys) && array_key_exists(3, $keys)) {
                    $join->whereRaw($keys[2] . ' = "' . $keys[3] . '"');
                }
            });
        }
    }
protected function makeJoins ( Builder $ query ) { foreach ( $ this -> getJoins ( ) as $ table => $ keys ) { $ query -> leftJoin ( $ table , function ( $ join ) use ( $ keys ) { $ join -> on ( $ keys [ 0 ] , '=' , $ keys [ 1 ] ) ; if ( array_key_exists ( 2 , $ keys ) && array_key_exists ( 3 , $ keys ) ) { $ join -> whereRaw ( $ keys [ 2 ] . ' = "' . $ keys [ 3 ] . '"' ) ; } } ) ; } }
Adds the sql joins to the query.

@param \Illuminate\Database\Eloquent\Builder $query
Adds the sql joins to the query .