99use Jenssegers \Mongodb \Relations \BelongsToMany ;
1010use Jenssegers \Mongodb \Relations \HasMany ;
1111use Jenssegers \Mongodb \Relations \HasOne ;
12- use Jenssegers \Mongodb \Relations \MorphTo ;
1312use Jenssegers \Mongodb \Relations \MorphMany ;
13+ use Jenssegers \Mongodb \Relations \MorphTo ;
1414
1515trait HybridRelations
1616{
@@ -24,7 +24,7 @@ trait HybridRelations
2424 public function hasOne ($ related , $ foreignKey = null , $ localKey = null )
2525 {
2626 // 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)) {
2828 return parent ::hasOne ($ related , $ foreignKey , $ localKey );
2929 }
3030
@@ -49,13 +49,13 @@ public function hasOne($related, $foreignKey = null, $localKey = null)
4949 public function morphOne ($ related , $ name , $ type = null , $ id = null , $ localKey = null )
5050 {
5151 // 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)) {
5353 return parent ::morphOne ($ related , $ name , $ type , $ id , $ localKey );
5454 }
5555
5656 $ instance = new $ related ;
5757
58- list ( $ type , $ id) = $ this ->getMorphs ($ name , $ type , $ id );
58+ [ $ type , $ id] = $ this ->getMorphs ($ name , $ type , $ id );
5959
6060 $ localKey = $ localKey ?: $ this ->getKeyName ();
6161
@@ -72,7 +72,7 @@ public function morphOne($related, $name, $type = null, $id = null, $localKey =
7272 public function hasMany ($ related , $ foreignKey = null , $ localKey = null )
7373 {
7474 // 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)) {
7676 return parent ::hasMany ($ related , $ foreignKey , $ localKey );
7777 }
7878
@@ -97,7 +97,7 @@ public function hasMany($related, $foreignKey = null, $localKey = null)
9797 public function morphMany ($ related , $ name , $ type = null , $ id = null , $ localKey = null )
9898 {
9999 // 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)) {
101101 return parent ::morphMany ($ related , $ name , $ type , $ id , $ localKey );
102102 }
103103
@@ -106,7 +106,7 @@ public function morphMany($related, $name, $type = null, $id = null, $localKey =
106106 // Here we will gather up the morph type and ID for the relationship so that we
107107 // can properly query the intermediate table of a relation. Finally, we will
108108 // 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 );
110110
111111 $ table = $ instance ->getTable ();
112112
@@ -129,21 +129,21 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat
129129 // the calling method's name and use that as the relationship name as most
130130 // of the time this will be what we desire to use for the relationships.
131131 if ($ relation === null ) {
132- list ( $ current , $ caller) = debug_backtrace (false , 2 );
132+ [ $ current , $ caller] = debug_backtrace (false , 2 );
133133
134134 $ relation = $ caller ['function ' ];
135135 }
136136
137137 // 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)) {
139139 return parent ::belongsTo ($ related , $ foreignKey , $ otherKey , $ relation );
140140 }
141141
142142 // If no foreign key was supplied, we can use a backtrace to guess the proper
143143 // foreign key name by using the name of the relationship function, which
144144 // when combined with an "_id" should conventionally match the columns.
145145 if ($ foreignKey === null ) {
146- $ foreignKey = Str::snake ($ relation ) . '_id ' ;
146+ $ foreignKey = Str::snake ($ relation ). '_id ' ;
147147 }
148148
149149 $ instance = new $ related ;
@@ -172,12 +172,12 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null
172172 // since that is most likely the name of the polymorphic interface. We can
173173 // use that to get both the class and foreign key that will be utilized.
174174 if ($ name === null ) {
175- list ( $ current , $ caller) = debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS , 2 );
175+ [ $ current , $ caller] = debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS , 2 );
176176
177177 $ name = Str::snake ($ caller ['function ' ]);
178178 }
179179
180- list ( $ type , $ id) = $ this ->getMorphs ($ name , $ type , $ id );
180+ [ $ type , $ id] = $ this ->getMorphs ($ name , $ type , $ id );
181181
182182 // If the type value is null it is probably safe to assume we're eager loading
183183 // the relationship. When that is the case we will pass in a dummy query as
@@ -230,7 +230,7 @@ public function belongsToMany(
230230 }
231231
232232 // 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)) {
234234 return parent ::belongsToMany (
235235 $ related ,
236236 $ collection ,
@@ -245,11 +245,11 @@ public function belongsToMany(
245245 // First, we'll need to determine the foreign key and "other key" for the
246246 // relationship. Once we have determined the keys we'll make the query
247247 // instances as well as the relationship instances we need for this.
248- $ foreignKey = $ foreignKey ?: $ this ->getForeignKey () . 's ' ;
248+ $ foreignKey = $ foreignKey ?: $ this ->getForeignKey (). 's ' ;
249249
250250 $ instance = new $ related ;
251251
252- $ otherKey = $ otherKey ?: $ instance ->getForeignKey () . 's ' ;
252+ $ otherKey = $ otherKey ?: $ instance ->getForeignKey (). 's ' ;
253253
254254 // If no table name was provided, we can guess it by concatenating the two
255255 // models using underscores in alphabetical order. The two model names
0 commit comments