@@ -75,7 +75,7 @@ public function getModel(): ?Model
7575 */
7676 public function withGlobalScopes (): self
7777 {
78- if (!$ this ->model ) {
78+ if (! $ this ->model ) {
7979 return $ this ;
8080 }
8181
@@ -96,7 +96,7 @@ public function withGlobalScopes(): self
9696 */
9797 protected function useTableAliasInConditions (): self
9898 {
99- if (!$ this ->alias || !$ this ->model ) {
99+ if (! $ this ->alias || ! $ this ->model ) {
100100 return $ this ;
101101 }
102102
@@ -117,18 +117,17 @@ protected function useAliasInWhereColumnType(array $where): array
117117 $ table = $ this ->tableName ;
118118
119119 // if it was already replaced, skip
120- if (Str::startsWith ($ where ['first ' ].'. ' , $ this ->alias .'. ' ) || Str::startsWith ($ where ['second ' ].'. ' ,
121- $ this ->alias .'. ' )) {
120+ if (Str::startsWith ($ where ['first ' ] . '. ' , $ this ->alias . '. ' ) || Str::startsWith ($ where ['second ' ] . '. ' , $ this ->alias . '. ' )) {
122121 return $ where ;
123122 }
124123
125124 if (Str::contains ($ where ['first ' ], $ table ) && Str::contains ($ where ['second ' ], $ table )) {
126125 // if joining the same table, only replace the correct table.key pair
127- $ where ['first ' ] = str_replace ($ table. '. ' . $ key , $ this ->alias . '. ' . $ key , $ where ['first ' ]);
128- $ where ['second ' ] = str_replace ($ table. '. ' . $ key , $ this ->alias . '. ' . $ key , $ where ['second ' ]);
126+ $ where ['first ' ] = str_replace ($ table . '. ' . $ key , $ this ->alias . '. ' . $ key , $ where ['first ' ]);
127+ $ where ['second ' ] = str_replace ($ table . '. ' . $ key , $ this ->alias . '. ' . $ key , $ where ['second ' ]);
129128 } else {
130- $ where ['first ' ] = str_replace ($ table. '. ' , $ this ->alias . '. ' , $ where ['first ' ]);
131- $ where ['second ' ] = str_replace ($ table. '. ' , $ this ->alias . '. ' , $ where ['second ' ]);
129+ $ where ['first ' ] = str_replace ($ table . '. ' , $ this ->alias . '. ' , $ where ['first ' ]);
130+ $ where ['second ' ] = str_replace ($ table . '. ' , $ this ->alias . '. ' , $ where ['second ' ]);
132131 }
133132
134133 return $ where ;
@@ -138,7 +137,7 @@ protected function useAliasInWhereBasicType(array $where): array
138137 {
139138 $ table = $ this ->tableName ;
140139
141- if (Str::startsWith ($ where ['column ' ]. '. ' , $ this ->alias . '. ' )) {
140+ if (Str::startsWith ($ where ['column ' ] . '. ' , $ this ->alias . '. ' )) {
142141 return $ where ;
143142 }
144143
@@ -161,16 +160,15 @@ public function whereNull($columns, $boolean = 'and', $not = false): self
161160
162161 public function newQuery (): self
163162 {
164- return new static ($ this ->newParentQuery (), $ this ->type , $ this ->table ,
165- $ this ->model ); // <-- The model param is needed
163+ return new static ($ this ->newParentQuery (), $ this ->type , $ this ->table , $ this ->model ); // <-- The model param is needed
166164 }
167165
168166 public function where ($ column , $ operator = null , $ value = null , $ boolean = 'and ' ): self
169167 {
170168 if ($ this ->alias && is_string ($ column ) && Str::contains ($ column , $ this ->tableName )) {
171169 $ column = str_replace ("{$ this ->tableName }. " , "{$ this ->alias }. " , $ column );
172- } elseif ($ this ->alias && !is_callable ($ column )) {
173- $ column = $ this ->alias . '. ' . $ column ;
170+ } elseif ($ this ->alias && ! is_callable ($ column )) {
171+ $ column = $ this ->alias . '. ' . $ column ;
174172 }
175173
176174 if (is_callable ($ column )) {
@@ -187,7 +185,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and'
187185 */
188186 public function withTrashed (): self
189187 {
190- if (!in_array (SoftDeletes::class, class_uses_recursive ($ this ->getModel ()))) {
188+ if (! in_array (SoftDeletes::class, class_uses_recursive ($ this ->getModel ()))) {
191189 return $ this ;
192190 }
193191
@@ -207,7 +205,7 @@ public function withTrashed(): self
207205 */
208206 public function onlyTrashed (): self
209207 {
210- if (!in_array (SoftDeletes::class, class_uses_recursive ($ this ->getModel ()))) {
208+ if (! in_array (SoftDeletes::class, class_uses_recursive ($ this ->getModel ()))) {
211209 return $ this ;
212210 }
213211
@@ -224,7 +222,7 @@ public function onlyTrashed(): self
224222
225223 public function __call ($ name , $ arguments )
226224 {
227- $ scope = 'scope ' . ucfirst ($ name );
225+ $ scope = 'scope ' . ucfirst ($ name );
228226
229227 if (method_exists ($ this ->getModel (), $ scope )) {
230228 return $ this ->getModel ()->{$ scope }($ this , ...$ arguments );
0 commit comments