protected function addVersion(Builder $builder)
    {
        $builder->macro('version', function(Builder $builder, $version) {
            $model = $builder->getModel();

            $this->remove($builder, $builder->getModel());

            $builder->join($model->getVersionTable(), function($join) use ($model, $version) {
                $join->on($model->getQualifiedKeyName(), '=', $model->getQualifiedVersionKeyName());
                $join->where($model->getQualifiedVersionColumn(), '=', $version);
            });

            return $builder;
        });
    }
protected function addVersion(Builder $builder)
    {
        $builder->macro('version', function(Builder $builder, $version) {
            $model = $builder->getModel();

            $this->remove($builder, $builder->getModel());

            $builder->join($model->getVersionTable(), function($join) use ($model, $version) {
                $join->on($model->getQualifiedKeyName(), '=', $model->getQualifiedVersionKeyName());
                $join->where($model->getQualifiedVersionColumn(), '=', $version);
            });

            return $builder;
        });
    }
protected function addVersion ( Builder $ builder ) { $ builder -> macro ( 'version' , function ( Builder $ builder , $ version ) { $ model = $ builder -> getModel ( ) ; $ this -> remove ( $ builder , $ builder -> getModel ( ) ) ; $ builder -> join ( $ model -> getVersionTable ( ) , function ( $ join ) use ( $ model , $ version ) { $ join -> on ( $ model -> getQualifiedKeyName ( ) , '=' , $ model -> getQualifiedVersionKeyName ( ) ) ; $ join -> where ( $ model -> getQualifiedVersionColumn ( ) , '=' , $ version ) ; } ) ; return $ builder ; } ) ; }
Add the version extension to the builder.

@param  \Illuminate\Database\Eloquent\Builder  $builder
@return void
Add the version extension to the builder .