@@ -13,7 +13,7 @@ |
||
13 | 13 | protected function getEnvironmentSetUp($app) |
14 | 14 | { |
15 | 15 | $app['config']->set('database.default', 'testing'); |
16 | - $app['router']->get('binary-users/{binaryUser}', function (TestBinaryUserHex $binaryUser) { |
|
16 | + $app['router']->get('binary-users/{binaryUser}', function(TestBinaryUserHex $binaryUser) { |
|
17 | 17 | return $binaryUser->toJson(); |
18 | 18 | })->middleware(SubstituteBindings::class); |
19 | 19 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function apply($query) |
42 | 42 | { |
43 | - $query->where(function ($query) { |
|
43 | + $query->where(function($query) { |
|
44 | 44 | foreach ($this->ids as $compositeKey) { |
45 | 45 | // try to parse normalized key |
46 | 46 | if (!is_array($compositeKey)) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | - $queryWriter = function ($query) use ($compositeKey) { |
|
59 | + $queryWriter = function($query) use ($compositeKey) { |
|
60 | 60 | /* |
61 | 61 | * @var \Illuminate\Database\Query\Builder $query |
62 | 62 | */ |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | // when combined with an "_id" should conventionally match the columns. |
48 | 48 | if (is_null($foreignKey)) { |
49 | 49 | $foreignKey = is_array($instance->getKeyName()) ? array_map( |
50 | - function ($key) use ($relation) { |
|
50 | + function($key) use ($relation) { |
|
51 | 51 | return Str::snake($relation).'_'.$key; |
52 | 52 | }, |
53 | 53 | $instance->getKeyName() |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | protected function newBelongsTo(Builder $query, Model $child, $foreignKey, $ownerKey, $relation) |
102 | 102 | { |
103 | - return $this->executeWithinOptionalBinaryTransformation(function () use ($query, $child, $foreignKey, $ownerKey, $relation) { |
|
103 | + return $this->executeWithinOptionalBinaryTransformation(function() use ($query, $child, $foreignKey, $ownerKey, $relation) { |
|
104 | 104 | return new CompositeBelongsTo($query, $child, $foreignKey, $ownerKey, $relation); |
105 | 105 | }, $query->getModel(), $child); |
106 | 106 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function newHasOne(Builder $query, Model $parent, $foreignKey, $localKey) |
119 | 119 | { |
120 | - return $this->executeWithinOptionalBinaryTransformation(function () use ($query, $parent, $foreignKey, $localKey) { |
|
120 | + return $this->executeWithinOptionalBinaryTransformation(function() use ($query, $parent, $foreignKey, $localKey) { |
|
121 | 121 | return new HasOne($query, $parent, $foreignKey, $localKey); |
122 | 122 | }, $query->getModel(), $parent); |
123 | 123 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | protected function newMorphOne(Builder $query, Model $parent, $type, $id, $localKey) |
137 | 137 | { |
138 | - return $this->executeWithinOptionalBinaryTransformation(function () use ($query, $parent, $type, $id, $localKey) { |
|
138 | + return $this->executeWithinOptionalBinaryTransformation(function() use ($query, $parent, $type, $id, $localKey) { |
|
139 | 139 | return new MorphOne($query, $parent, $type, $id, $localKey); |
140 | 140 | }, $query->getModel(), $parent); |
141 | 141 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | protected function newMorphTo(Builder $query, Model $parent, $foreignKey, $ownerKey, $type, $relation) |
156 | 156 | { |
157 | - return $this->executeWithinOptionalBinaryTransformation(function () use ($query, $parent, $foreignKey, $ownerKey, $type, $relation) { |
|
157 | + return $this->executeWithinOptionalBinaryTransformation(function() use ($query, $parent, $foreignKey, $ownerKey, $type, $relation) { |
|
158 | 158 | return new MorphTo($query, $parent, $foreignKey, $ownerKey, $type, $relation); |
159 | 159 | }, $query->getModel(), $parent); |
160 | 160 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | protected function newHasMany(Builder $query, Model $parent, $foreignKey, $localKey) |
173 | 173 | { |
174 | - return $this->executeWithinOptionalBinaryTransformation(function () use ($query, $parent, $foreignKey, $localKey) { |
|
174 | + return $this->executeWithinOptionalBinaryTransformation(function() use ($query, $parent, $foreignKey, $localKey) { |
|
175 | 175 | return new HasMany($query, $parent, $foreignKey, $localKey); |
176 | 176 | }, $query->getModel(), $parent); |
177 | 177 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | protected function newHasManyThrough(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey) |
193 | 193 | { |
194 | - return $this->executeWithinOptionalBinaryTransformation(function () use ($query, $farParent, $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey) { |
|
194 | + return $this->executeWithinOptionalBinaryTransformation(function() use ($query, $farParent, $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey) { |
|
195 | 195 | return new HasManyThrough($query, $farParent, $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey); |
196 | 196 | }, $query->getModel(), $farParent); |
197 | 197 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | protected function newMorphMany(Builder $query, Model $parent, $type, $id, $localKey) |
211 | 211 | { |
212 | - return $this->executeWithinOptionalBinaryTransformation(function () use ($query, $parent, $type, $id, $localKey) { |
|
212 | + return $this->executeWithinOptionalBinaryTransformation(function() use ($query, $parent, $type, $id, $localKey) { |
|
213 | 213 | return new MorphMany($query, $parent, $type, $id, $localKey); |
214 | 214 | }, $query->getModel(), $parent); |
215 | 215 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | protected function newBelongsToMany(Builder $query, Model $parent, $table, $foreignPivotKey, $relatedPivotKey, |
232 | 232 | $parentKey, $relatedKey, $relationName = null) |
233 | 233 | { |
234 | - return $this->executeWithinOptionalBinaryTransformation(function () use ($query, $parent, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, $relationName) { |
|
234 | + return $this->executeWithinOptionalBinaryTransformation(function() use ($query, $parent, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, $relationName) { |
|
235 | 235 | return new CompositeBelongsToMany($query, $parent, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, $relationName); |
236 | 236 | }, $query->getModel(), $parent); |
237 | 237 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $relatedPivotKey, $parentKey, $relatedKey, |
257 | 257 | $relationName = null, $inverse = false) |
258 | 258 | { |
259 | - return $this->executeWithinOptionalBinaryTransformation(function () use ($query, $parent, $name, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, |
|
259 | + return $this->executeWithinOptionalBinaryTransformation(function() use ($query, $parent, $name, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, |
|
260 | 260 | $relationName, $inverse) { |
261 | 261 | return new MorphToMany($query, $parent, $name, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, |
262 | 262 | $relationName, $inverse); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | private function normalizeIds($ids) |
21 | 21 | { |
22 | - return $this->getQuery()->getModel()->hexBinaryColumns() ? (is_array($ids) ? array_map(function ($id) { |
|
22 | + return $this->getQuery()->getModel()->hexBinaryColumns() ? (is_array($ids) ? array_map(function($id) { |
|
23 | 23 | return $this->normalizeValue($id); |
24 | 24 | }, $ids) : $this->normalizeValue($ids)) : $ids; |
25 | 25 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | protected function parseIds($value) |
35 | 35 | { |
36 | 36 | if ($value instanceof Model) { |
37 | - return [$this->executeWithinOptionalBinaryTransformation(function () use ($value) { |
|
37 | + return [$this->executeWithinOptionalBinaryTransformation(function() use ($value) { |
|
38 | 38 | return $value->{$this->relatedKey}; |
39 | 39 | }, $value)]; |
40 | 40 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | protected function parseId($value) |
61 | 61 | { |
62 | - return $value instanceof Model ? $this->executeWithinOptionalBinaryTransformation(function () use ($value) { |
|
62 | + return $value instanceof Model ? $this->executeWithinOptionalBinaryTransformation(function() use ($value) { |
|
63 | 63 | $value->{$this->relatedKey}; |
64 | 64 | }, $value) : $value; |
65 | 65 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | call_user_func_array([$query, 'whereIn'], $arguments); |
82 | 82 | } |
83 | 83 | |
84 | - return $this->executeWithinOptionalBinaryTransformation(function () use ($query) { |
|
84 | + return $this->executeWithinOptionalBinaryTransformation(function() use ($query) { |
|
85 | 85 | return $query->where($this->foreignPivotKey, $this->parent->{$this->parentKey}); |
86 | 86 | }, $this->parent); |
87 | 87 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | $record[$this->relatedPivotKey] = $id; |
100 | 100 | |
101 | - $record[$this->foreignPivotKey] = $this->executeWithinOptionalBinaryTransformation(function () { |
|
101 | + $record[$this->foreignPivotKey] = $this->executeWithinOptionalBinaryTransformation(function() { |
|
102 | 102 | return $this->parent->{$this->parentKey}; |
103 | 103 | }, $this->parent); |
104 | 104 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public static function bootHasCompositePrimaryKey() |
21 | 21 | { |
22 | - static::creating(function ($model) { |
|
22 | + static::creating(function($model) { |
|
23 | 23 | foreach ($model->getRawKeyName() as $key) { |
24 | 24 | if ((!isset($model->{$key}) || empty($model->{$key})) && in_array($key, $model->getBinaryColumns())) { |
25 | 25 | $v = uniqid(rand(), true); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } else { |
156 | 156 | //remap hex ID to binary ID even if index is not composite |
157 | 157 | if ($this->shouldProcessBinaryAttribute($keys[0])) { |
158 | - $ids = array_map(function ($hex) use ($keys) { |
|
158 | + $ids = array_map(function($hex) use ($keys) { |
|
159 | 159 | return $this->recoverBinaryKey($keys[0], $hex); |
160 | 160 | }, $ids); |
161 | 161 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | return $this->newQueryWithoutScopes()->applyIds( |
187 | 187 | array_map( |
188 | - function ($normalizedKey) { |
|
188 | + function($normalizedKey) { |
|
189 | 189 | return $this->hasCompositeIndex() ? $this->parseNormalizedKey($normalizedKey) : $normalizedKey; |
190 | 190 | }, |
191 | 191 | $ids |