1- <?php namespace Jenssegers \Mongodb \Eloquent ;
1+ <?php
2+
3+ namespace Jenssegers \Mongodb \Eloquent ;
24
35use Illuminate \Database \Eloquent \Relations \MorphMany ;
46use Illuminate \Database \Eloquent \Relations \MorphOne ;
@@ -23,7 +25,7 @@ trait HybridRelations
2325 public function hasOne ($ related , $ foreignKey = null , $ localKey = null )
2426 {
2527 // Check if it is a relation with an original model.
26- if (! is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
28+ if (!is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
2729 return parent ::hasOne ($ related , $ foreignKey , $ localKey );
2830 }
2931
@@ -49,7 +51,7 @@ public function hasOne($related, $foreignKey = null, $localKey = null)
4951 public function morphOne ($ related , $ name , $ type = null , $ id = null , $ localKey = null )
5052 {
5153 // Check if it is a relation with an original model.
52- if (! is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
54+ if (!is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
5355 return parent ::morphOne ($ related , $ name , $ type , $ id , $ localKey );
5456 }
5557
@@ -73,7 +75,7 @@ public function morphOne($related, $name, $type = null, $id = null, $localKey =
7375 public function hasMany ($ related , $ foreignKey = null , $ localKey = null )
7476 {
7577 // Check if it is a relation with an original model.
76- if (! is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
78+ if (!is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
7779 return parent ::hasMany ($ related , $ foreignKey , $ localKey );
7880 }
7981
@@ -99,7 +101,7 @@ public function hasMany($related, $foreignKey = null, $localKey = null)
99101 public function morphMany ($ related , $ name , $ type = null , $ id = null , $ localKey = null )
100102 {
101103 // Check if it is a relation with an original model.
102- if (! is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
104+ if (!is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
103105 return parent ::morphMany ($ related , $ name , $ type , $ id , $ localKey );
104106 }
105107
@@ -138,15 +140,15 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat
138140 }
139141
140142 // Check if it is a relation with an original model.
141- if (! is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
143+ if (!is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
142144 return parent ::belongsTo ($ related , $ foreignKey , $ otherKey , $ relation );
143145 }
144146
145147 // If no foreign key was supplied, we can use a backtrace to guess the proper
146148 // foreign key name by using the name of the relationship function, which
147149 // when combined with an "_id" should conventionally match the columns.
148150 if (is_null ($ foreignKey )) {
149- $ foreignKey = Str::snake ($ relation ). '_id ' ;
151+ $ foreignKey = Str::snake ($ relation ) . '_id ' ;
150152 }
151153
152154 $ instance = new $ related ;
@@ -225,18 +227,18 @@ public function belongsToMany($related, $collection = null, $foreignKey = null,
225227 }
226228
227229 // Check if it is a relation with an original model.
228- if (! is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
230+ if (!is_subclass_of ($ related , \Jenssegers \Mongodb \Eloquent \Model::class)) {
229231 return parent ::belongsToMany ($ related , $ collection , $ foreignKey , $ otherKey , $ relation );
230232 }
231233
232234 // First, we'll need to determine the foreign key and "other key" for the
233235 // relationship. Once we have determined the keys we'll make the query
234236 // instances as well as the relationship instances we need for this.
235- $ foreignKey = $ foreignKey ?: $ this ->getForeignKey (). 's ' ;
237+ $ foreignKey = $ foreignKey ?: $ this ->getForeignKey () . 's ' ;
236238
237239 $ instance = new $ related ;
238240
239- $ otherKey = $ otherKey ?: $ instance ->getForeignKey (). 's ' ;
241+ $ otherKey = $ otherKey ?: $ instance ->getForeignKey () . 's ' ;
240242
241243 // If no table name was provided, we can guess it by concatenating the two
242244 // models using underscores in alphabetical order. The two model names
0 commit comments