|
@@ -47,7 +47,7 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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
|
} |
|
@@ -239,7 +239,7 @@ discard block |
|
|
block discarded – undo |
|
239
|
239
|
$relationName = null |
|
240
|
240
|
) |
|
241
|
241
|
{ |
|
242
|
|
- return $this->executeWithinOptionalBinaryTransformation(function () use ($query, $parent, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, $relationName) { |
|
|
242
|
+ return $this->executeWithinOptionalBinaryTransformation(function() use ($query, $parent, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, $relationName) { |
|
243
|
243
|
return new CompositeBelongsToMany($query, $parent, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, $relationName); |
|
244
|
244
|
}, $query->getModel(), $parent); |
|
245
|
245
|
} |
|
@@ -273,7 +273,7 @@ discard block |
|
|
block discarded – undo |
|
273
|
273
|
$inverse = false |
|
274
|
274
|
) |
|
275
|
275
|
{ |
|
276
|
|
- return $this->executeWithinOptionalBinaryTransformation(function () use ($query, $parent, $name, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, |
|
|
276
|
+ return $this->executeWithinOptionalBinaryTransformation(function() use ($query, $parent, $name, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, |
|
277
|
277
|
$relationName, $inverse) { |
|
278
|
278
|
return new MorphToMany( |
|
279
|
279
|
$query, |