@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | |
106 | 106 | $threshold = (is_null($threshold)) |
107 | 107 | ? array_sum($columns->getWeights()) / 4 |
108 | - : (float) $threshold ; |
|
108 | + : (float) $threshold; |
|
109 | 109 | |
110 | - $subquery->select($this->model->getTable().'.*') |
|
110 | + $subquery->select($this->model->getTable() . '.*') |
|
111 | 111 | ->from($this->model->getTable()) |
112 | 112 | ->groupBy($this->model->getQualifiedKeyName()); |
113 | 113 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $whereBindings = $this->searchSelect($subquery, $columns, $words, $threshold); |
135 | 135 | |
136 | 136 | // For morphOne/morphMany support we need to port the bindings from JoinClauses. |
137 | - $joinBindings = array_flatten(array_pluck((array)$subquery->getQuery()->joins, 'bindings')); |
|
137 | + $joinBindings = array_flatten(array_pluck((array) $subquery->getQuery()->joins, 'bindings')); |
|
138 | 138 | |
139 | 139 | $this->addBinding($joinBindings, 'select'); |
140 | 140 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | if (in_array($type, $typesToMove) && $this->model->hasColumn($where['column'])) { |
239 | 239 | unset($this->query->wheres[$key]); |
240 | 240 | |
241 | - $where['column'] = $this->model->getTable().'.'.$where['column']; |
|
241 | + $where['column'] = $this->model->getTable() . '.' . $where['column']; |
|
242 | 242 | |
243 | 243 | $subquery->getQuery()->wheres[] = $where; |
244 | 244 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | protected function countBindings(array $where, $type) |
270 | 270 | { |
271 | 271 | if ($this->isHasWhere($where, $type)) { |
272 | - return substr_count($where['column'].$where['value'], '?'); |
|
272 | + return substr_count($where['column'] . $where['value'], '?'); |
|
273 | 273 | |
274 | 274 | } elseif ($type === 'basic') { |
275 | 275 | return (int) !$where['value'] instanceof Expression; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | |
323 | 323 | $operator = $this->getLikeOperator(); |
324 | 324 | |
325 | - $bindings['select'] = $bindings['where'] = array_map(function ($word) { |
|
325 | + $bindings['select'] = $bindings['where'] = array_map(function($word) { |
|
326 | 326 | return $this->caseBinding($word); |
327 | 327 | }, $words); |
328 | 328 | |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | foreach ($words as $key => $word) { |
335 | 335 | if ($this->isLeftMatching($word)) { |
336 | 336 | $leftMatching[] = sprintf('%s %s ?', $column->getWrapped(), $operator); |
337 | - $bindings['select'][] = $bindings['where'][$key] = $this->caseBinding($word).'%'; |
|
337 | + $bindings['select'][] = $bindings['where'][$key] = $this->caseBinding($word) . '%'; |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | foreach ($words as $key => $word) { |
350 | 350 | if ($this->isWildcard($word)) { |
351 | 351 | $wildcards[] = sprintf('%s %s ?', $column->getWrapped(), $operator); |
352 | - $bindings['select'][] = $bindings['where'][$key] = '%'.$this->caseBinding($word).'%'; |
|
352 | + $bindings['select'][] = $bindings['where'][$key] = '%' . $this->caseBinding($word) . '%'; |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
@@ -478,12 +478,12 @@ discard block |
||
478 | 478 | public function prefixColumnsForJoin() |
479 | 479 | { |
480 | 480 | if (!$columns = $this->query->columns) { |
481 | - return $this->select($this->model->getTable().'.*'); |
|
481 | + return $this->select($this->model->getTable() . '.*'); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | foreach ($columns as $key => $column) { |
485 | 485 | if ($this->model->hasColumn($column)) { |
486 | - $columns[$key] = $this->model->getTable().'.'.$column; |
|
486 | + $columns[$key] = $this->model->getTable() . '.' . $column; |
|
487 | 487 | } |
488 | 488 | } |
489 | 489 |
@@ -127,7 +127,7 @@ |
||
127 | 127 | { |
128 | 128 | static::loadColumnListing(); |
129 | 129 | |
130 | - return in_array((string)$key, static::$columnListing); |
|
130 | + return in_array((string) $key, static::$columnListing); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | protected function mappedSelectListsKey(Builder $query, $key) |
210 | 210 | { |
211 | 211 | if ($this->hasColumn($key)) { |
212 | - return $query->addSelect($this->getTable().'.'.$key); |
|
212 | + return $query->addSelect($this->getTable() . '.' . $key); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | return $query->addSelect($key); |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | if (!$this->alreadyJoined($query, $table)) { |
256 | 256 | list($fk, $pk) = $this->getJoinKeys($relation); |
257 | 257 | |
258 | - $query->leftJoin($table, function ($join) use ($fk, $pk, $relation, $parent, $related) { |
|
258 | + $query->leftJoin($table, function($join) use ($fk, $pk, $relation, $parent, $related) { |
|
259 | 259 | $join->on($fk, '=', $pk); |
260 | 260 | |
261 | 261 | if ($relation instanceof MorphOne || $relation instanceof MorphTo) { |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | */ |
356 | 356 | protected function getMappedWhereConstraint($method, ArgumentBag $args) |
357 | 357 | { |
358 | - return function ($query) use ($method, $args) { |
|
358 | + return function($query) use ($method, $args) { |
|
359 | 359 | call_user_func_array([$query, $method], $args->all()); |
360 | 360 | }; |
361 | 361 | } |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | $this->parseMappings(); |
432 | 432 | } |
433 | 433 | |
434 | - return array_key_exists((string)$key, static::$mappedAttributes); |
|
434 | + return array_key_exists((string) $key, static::$mappedAttributes); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | /** |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | if (strpos($key, '.') !== false) { |
178 | 178 | return $query->addSelect($key); |
179 | 179 | } elseif ($this->hasColumn($key)) { |
180 | - return $query->addSelect($this->getTable().'.'.$key); |
|
180 | + return $query->addSelect($this->getTable() . '.' . $key); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | $alias = $this->joinMeta($query, $key); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | $table = (new Attribute)->getTable(); |
216 | 216 | |
217 | - $query->leftJoin("{$table} as {$alias}", function ($join) use ($alias, $column) { |
|
217 | + $query->leftJoin("{$table} as {$alias}", function($join) use ($alias, $column) { |
|
218 | 218 | $join->on("{$alias}.metable_id", '=', $this->getQualifiedKeyName()) |
219 | 219 | ->where("{$alias}.metable_type", '=', $this->getMorphClass()) |
220 | 220 | ->where("{$alias}.meta_key", '=', $column); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | protected function generateMetaAlias() |
232 | 232 | { |
233 | - return md5(microtime(true)).'_meta_alias'; |
|
233 | + return md5(microtime(true)) . '_meta_alias'; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | return $this->getMetaBetweenConstraint($column, $args->get('values')); |
327 | 327 | } |
328 | 328 | |
329 | - return function ($query) use ($column, $method, $args) { |
|
329 | + return function($query) use ($column, $method, $args) { |
|
330 | 330 | $query->where('meta_key', $column); |
331 | 331 | |
332 | 332 | if ($args->get('value') || $args->get('values')) { |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $min = $values[0]; |
348 | 348 | $max = $values[1]; |
349 | 349 | |
350 | - return function ($query) use ($column, $min, $max) { |
|
350 | + return function($query) use ($column, $min, $max) { |
|
351 | 351 | $query->where('meta_key', $column) |
352 | 352 | ->where('meta_value', '>=', $min) |
353 | 353 | ->where('meta_value', '<=', $max); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function up() |
28 | 28 | { |
29 | - \Schema::create($this->table, function (Blueprint $table) { |
|
29 | + \Schema::create($this->table, function(Blueprint $table) { |
|
30 | 30 | $table->increments('meta_id'); |
31 | 31 | $table->string('meta_key'); |
32 | 32 | $table->longText('meta_value'); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function getAttribute() |
19 | 19 | { |
20 | - return function ($next, $value, $args) { |
|
20 | + return function($next, $value, $args) { |
|
21 | 21 | $key = $args->get('key'); |
22 | 22 | |
23 | 23 | if (is_null($value)) { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function setAttribute() |
37 | 37 | { |
38 | - return function ($next, $value, $args) { |
|
38 | + return function($next, $value, $args) { |
|
39 | 39 | $key = $args->get('key'); |
40 | 40 | |
41 | 41 | if (!$this->hasColumn($key) && $this->allowsMeta($key) && !$this->hasSetMutator($key)) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function toArray() |
55 | 55 | { |
56 | - return function ($next, $attributes) { |
|
56 | + return function($next, $attributes) { |
|
57 | 57 | unset($attributes['meta_attributes'], $attributes['metaAttributes']); |
58 | 58 | |
59 | 59 | $attributes = array_merge($attributes, $this->getMetaAttributesArray()); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function replicate() |
71 | 71 | { |
72 | - return function ($next, $copy, $args) { |
|
72 | + return function($next, $copy, $args) { |
|
73 | 73 | $metaAttributes = $args->get('original') |
74 | 74 | ->getMetaAttributes() |
75 | 75 | ->replicate($args->get('except')); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function save() |
89 | 89 | { |
90 | - return function ($next, $value, $args) { |
|
90 | + return function($next, $value, $args) { |
|
91 | 91 | $this->saveMeta(); |
92 | 92 | |
93 | 93 | return $next($value, $args); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function __issetHook() |
103 | 103 | { |
104 | - return function ($next, $isset, $args) { |
|
104 | + return function($next, $isset, $args) { |
|
105 | 105 | $key = $args->get('key'); |
106 | 106 | |
107 | 107 | if (!$isset) { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function __unsetHook() |
121 | 121 | { |
122 | - return function ($next, $value, $args) { |
|
122 | + return function($next, $value, $args) { |
|
123 | 123 | $key = $args->get('key'); |
124 | 124 | |
125 | 125 | if ($this->hasMeta($key)) { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function queryHook() |
139 | 139 | { |
140 | - return function ($next, $query, $bag) { |
|
140 | + return function($next, $query, $bag) { |
|
141 | 141 | $method = $bag->get('method'); |
142 | 142 | $args = $bag->get('args'); |
143 | 143 | $column = $args->get('column'); |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | |
157 | 157 | public function __call($method, $params) |
158 | 158 | { |
159 | - if (strpos($method, '__') === 0 && method_exists($this, $method.'Hook')) { |
|
160 | - return call_user_func_array([$this, $method.'Hook'], $params); |
|
159 | + if (strpos($method, '__') === 0 && method_exists($this, $method . 'Hook')) { |
|
160 | + return call_user_func_array([$this, $method . 'Hook'], $params); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | throw new BadMethodCallException("Method [{$method}] doesn't exist on this object."); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public function getAttribute() |
17 | 17 | { |
18 | - return function ($next, $value, $args) { |
|
18 | + return function($next, $value, $args) { |
|
19 | 19 | $key = $args->get('key'); |
20 | 20 | |
21 | 21 | if ($this->hasGetterMutator($key)) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function setAttribute() |
35 | 35 | { |
36 | - return function ($next, $value, $args) { |
|
36 | + return function($next, $value, $args) { |
|
37 | 37 | $key = $args->get('key'); |
38 | 38 | |
39 | 39 | if ($this->hasSetterMutator($key)) { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function toArray() |
53 | 53 | { |
54 | - return function ($next, $attributes) { |
|
54 | + return function($next, $attributes) { |
|
55 | 55 | $attributes = $this->mutableAttributesToArray($attributes); |
56 | 56 | |
57 | 57 | return $next($attributes); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $fk = $relation->getForeignKey(); |
157 | 157 | } else { |
158 | 158 | $table = $relation->getParent()->getTable(); |
159 | - $fk = $table.'.'.$parent->getForeignKey(); |
|
159 | + $fk = $table . '.' . $parent->getForeignKey(); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | $pk = $parent->getQualifiedKeyName(); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | if ($relation instanceof HasManyThrough) { |
196 | - $fk = $relation->getRelated()->getTable().'.'.$relation->getParent()->getForeignKey(); |
|
196 | + $fk = $relation->getRelated()->getTable() . '.' . $relation->getParent()->getForeignKey(); |
|
197 | 197 | |
198 | 198 | return [$fk, $relation->getParent()->getQualifiedKeyName()]; |
199 | 199 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | */ |
56 | 56 | public function getQualifiedName() |
57 | 57 | { |
58 | - return $this->getTable().'.'.$this->getName(); |
|
58 | + return $this->getTable() . '.' . $this->getName(); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |