@@ -33,25 +33,6 @@ public function apply(Builder $builder, Model $model)
3333        $ this extend ($ builder
3434    }
3535
36-     /** 
37-      * Remove the scope from the given Eloquent query builder. 
38-      * 
39-      * @param  \Illuminate\Database\Eloquent\Builder  $builder 
40-      * @param  \Illuminate\Database\Eloquent\Model  $model 
41-      * @return void 
42-      */ 
43-     public  function  remove (Builder $ builderModel $ model
44-     {
45-         $ table$ modelgetVersionTable ();
46- 
47-         $ query$ buildergetQuery ();
48- 
49-         $ queryjoins  = collect ($ queryjoins )->reject (function ($ joinuse  ($ table
50-         {
51-             return  $ this isVersionJoinConstraint ($ join$ table
52-         })->values ()->all ();
53-     }
54- 
5536    /** 
5637     * Extend the query builder with the needed functions. 
5738     * 
@@ -77,9 +58,7 @@ protected function addVersion(Builder $builder)
7758        $ buildermacro ('version ' , function (Builder $ builder$ version
7859            $ model$ buildergetModel ();
7960
80-             $ this remove ($ builder$ buildergetModel ());
81- 
82-             $ builderjoin ($ modelgetVersionTable (), function ($ joinuse  ($ model$ version
61+             $ builderwithoutGlobalScope ($ this join ($ modelgetVersionTable (), function ($ joinuse  ($ model$ version
8362                $ joinon ($ modelgetQualifiedKeyName (), '= ' , $ modelgetQualifiedVersionKeyName ());
8463                $ joinwhere ($ modelgetQualifiedVersionColumn (), '= ' , $ version
8564            });
@@ -99,26 +78,12 @@ protected function addAllVersions(Builder $builder)
9978        $ buildermacro ('allVersions ' , function (Builder $ builder
10079            $ model$ buildergetModel ();
10180
102-             $ this remove ($ builder$ buildergetModel ());
103- 
104-             $ builderjoin ($ modelgetVersionTable (), function ($ joinuse  ($ model
81+             $ builderwithoutGlobalScope ($ this join ($ modelgetVersionTable (), function ($ joinuse  ($ model
10582                $ joinon ($ modelgetQualifiedKeyName (), '= ' , $ modelgetQualifiedVersionKeyName ());
10683            });
10784
10885            return  $ builder
10986        });
11087    }
11188
112-     /** 
113-      * Determine if the given join clause is a version constraint. 
114-      * 
115-      * @param  \Illuminate\Database\Query\JoinClause   $join 
116-      * @param  string  $column 
117-      * @return bool 
118-      */ 
119-     protected  function  isVersionJoinConstraint (JoinClause $ join$ table
120-     {
121-         return  $ jointype  == 'inner '  && $ jointable  == $ table
122-     }
123- 
12489}
0 commit comments