9
9
use Jenssegers \Mongodb \Relations \BelongsToMany ;
10
10
use Jenssegers \Mongodb \Relations \HasMany ;
11
11
use Jenssegers \Mongodb \Relations \HasOne ;
12
- use Jenssegers \Mongodb \Relations \MorphTo ;
13
12
use Jenssegers \Mongodb \Relations \MorphMany ;
13
+ use Jenssegers \Mongodb \Relations \MorphTo ;
14
14
15
15
trait HybridRelations
16
16
{
@@ -24,7 +24,7 @@ trait HybridRelations
24
24
public function hasOne ($ related , $ foreignKey = null , $ localKey = null )
25
25
{
26
26
// Check if it is a relation with an original model.
27
- if (!is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
27
+ if (! is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
28
28
return parent ::hasOne ($ related , $ foreignKey , $ localKey );
29
29
}
30
30
@@ -49,13 +49,13 @@ public function hasOne($related, $foreignKey = null, $localKey = null)
49
49
public function morphOne ($ related , $ name , $ type = null , $ id = null , $ localKey = null )
50
50
{
51
51
// Check if it is a relation with an original model.
52
- if (!is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
52
+ if (! is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
53
53
return parent ::morphOne ($ related , $ name , $ type , $ id , $ localKey );
54
54
}
55
55
56
56
$ instance = new $ related ;
57
57
58
- list ( $ type , $ id) = $ this ->getMorphs ($ name , $ type , $ id );
58
+ [ $ type , $ id] = $ this ->getMorphs ($ name , $ type , $ id );
59
59
60
60
$ localKey = $ localKey ?: $ this ->getKeyName ();
61
61
@@ -72,7 +72,7 @@ public function morphOne($related, $name, $type = null, $id = null, $localKey =
72
72
public function hasMany ($ related , $ foreignKey = null , $ localKey = null )
73
73
{
74
74
// Check if it is a relation with an original model.
75
- if (!is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
75
+ if (! is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
76
76
return parent ::hasMany ($ related , $ foreignKey , $ localKey );
77
77
}
78
78
@@ -97,7 +97,7 @@ public function hasMany($related, $foreignKey = null, $localKey = null)
97
97
public function morphMany ($ related , $ name , $ type = null , $ id = null , $ localKey = null )
98
98
{
99
99
// Check if it is a relation with an original model.
100
- if (!is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
100
+ if (! is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
101
101
return parent ::morphMany ($ related , $ name , $ type , $ id , $ localKey );
102
102
}
103
103
@@ -106,7 +106,7 @@ public function morphMany($related, $name, $type = null, $id = null, $localKey =
106
106
// Here we will gather up the morph type and ID for the relationship so that we
107
107
// can properly query the intermediate table of a relation. Finally, we will
108
108
// get the table and create the relationship instances for the developers.
109
- list ( $ type , $ id) = $ this ->getMorphs ($ name , $ type , $ id );
109
+ [ $ type , $ id] = $ this ->getMorphs ($ name , $ type , $ id );
110
110
111
111
$ table = $ instance ->getTable ();
112
112
@@ -129,21 +129,21 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat
129
129
// the calling method's name and use that as the relationship name as most
130
130
// of the time this will be what we desire to use for the relationships.
131
131
if ($ relation === null ) {
132
- list ( $ current , $ caller) = debug_backtrace (false , 2 );
132
+ [ $ current , $ caller] = debug_backtrace (false , 2 );
133
133
134
134
$ relation = $ caller ['function ' ];
135
135
}
136
136
137
137
// Check if it is a relation with an original model.
138
- if (!is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
138
+ if (! is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
139
139
return parent ::belongsTo ($ related , $ foreignKey , $ otherKey , $ relation );
140
140
}
141
141
142
142
// If no foreign key was supplied, we can use a backtrace to guess the proper
143
143
// foreign key name by using the name of the relationship function, which
144
144
// when combined with an "_id" should conventionally match the columns.
145
145
if ($ foreignKey === null ) {
146
- $ foreignKey = Str::snake ($ relation ) . '_id ' ;
146
+ $ foreignKey = Str::snake ($ relation ). '_id ' ;
147
147
}
148
148
149
149
$ instance = new $ related ;
@@ -172,12 +172,12 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null
172
172
// since that is most likely the name of the polymorphic interface. We can
173
173
// use that to get both the class and foreign key that will be utilized.
174
174
if ($ name === null ) {
175
- list ( $ current , $ caller) = debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS , 2 );
175
+ [ $ current , $ caller] = debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS , 2 );
176
176
177
177
$ name = Str::snake ($ caller ['function ' ]);
178
178
}
179
179
180
- list ( $ type , $ id) = $ this ->getMorphs ($ name , $ type , $ id );
180
+ [ $ type , $ id] = $ this ->getMorphs ($ name , $ type , $ id );
181
181
182
182
// If the type value is null it is probably safe to assume we're eager loading
183
183
// the relationship. When that is the case we will pass in a dummy query as
@@ -230,7 +230,7 @@ public function belongsToMany(
230
230
}
231
231
232
232
// Check if it is a relation with an original model.
233
- if (!is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
233
+ if (! is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
234
234
return parent ::belongsToMany (
235
235
$ related ,
236
236
$ collection ,
@@ -245,11 +245,11 @@ public function belongsToMany(
245
245
// First, we'll need to determine the foreign key and "other key" for the
246
246
// relationship. Once we have determined the keys we'll make the query
247
247
// instances as well as the relationship instances we need for this.
248
- $ foreignKey = $ foreignKey ?: $ this ->getForeignKey () . 's ' ;
248
+ $ foreignKey = $ foreignKey ?: $ this ->getForeignKey (). 's ' ;
249
249
250
250
$ instance = new $ related ;
251
251
252
- $ otherKey = $ otherKey ?: $ instance ->getForeignKey () . 's ' ;
252
+ $ otherKey = $ otherKey ?: $ instance ->getForeignKey (). 's ' ;
253
253
254
254
// If no table name was provided, we can guess it by concatenating the two
255
255
// models using underscores in alphabetical order. The two model names
@@ -289,7 +289,7 @@ protected function guessBelongsToManyRelation()
289
289
}
290
290
291
291
/**
292
- * @inheritdoc
292
+ * { @inheritdoc}
293
293
*/
294
294
public function newEloquentBuilder ($ query )
295
295
{
0 commit comments