33namespace Multicaret \Acquaintances ;
44
55use Illuminate \Database \Eloquent \Model ;
6- use Illuminate \Support \Str ;
76use Illuminate \Database \Eloquent \Relations \MorphToMany ;
7+ use Illuminate \Support \Str ;
88use stdClass ;
99
1010/**
@@ -71,8 +71,10 @@ public static function isRelationExists(Model $model, $relation, $target, $class
7171 $ userIdFkColumnName = config ('acquaintances.tables.interactions_user_id_fk_column_name ' , 'user_id ' );
7272
7373 return $ model ->{$ relation }($ target ->classname )
74- ->where ($ class ? config ('acquaintances.tables.interactions ' , 'interactions ' ) . '.subject_id ' : config ('acquaintances.tables.interactions ' , 'interactions ' ) . '. ' . $ userIdFkColumnName , head ($ target ->ids ))
75- ->exists ();
74+ ->where ($ class ? config ('acquaintances.tables.interactions ' ,
75+ 'interactions ' ).'.subject_id ' : config ('acquaintances.tables.interactions ' ,
76+ 'interactions ' ).'. ' .$ userIdFkColumnName , head ($ target ->ids ))
77+ ->exists ();
7678 }
7779
7880 /**
@@ -160,7 +162,7 @@ public static function formatTargets($targets, $classname, array $update = [])
160162 $ result = new stdClass ();
161163 $ result ->classname = $ classname ;
162164
163- if (! is_array ($ targets )) {
165+ if ( ! is_array ($ targets )) {
164166 $ targets = [$ targets ];
165167 }
166168
@@ -191,7 +193,7 @@ public static function formatTargets($targets, $classname, array $update = [])
191193 */
192194 protected static function getRelationTypeFromRelation (MorphToMany $ relation )
193195 {
194- if (! \array_key_exists ($ relation ->getRelationName (), self ::$ relationMap )) {
196+ if ( ! \array_key_exists ($ relation ->getRelationName (), self ::$ relationMap )) {
195197 throw new \Exception ('Invalid relation definition. ' );
196198 }
197199
@@ -202,7 +204,7 @@ static public function numberToReadable($number, $precision = 1, $divisors = nul
202204 {
203205 $ shorthand = '' ;
204206 $ divisor = pow (1000 , 0 );
205- if (! isset ($ divisors )) {
207+ if ( ! isset ($ divisors )) {
206208 $ divisors = [
207209 $ divisor => $ shorthand , // 1000^0 == 1
208210 pow (1000 , 1 ) => 'K ' , // Thousand
@@ -219,11 +221,10 @@ static public function numberToReadable($number, $precision = 1, $divisors = nul
219221 }
220222 }
221223
222- return number_format ($ number / $ divisor , $ precision ) . $ shorthand ;
224+ return number_format ($ number / $ divisor , $ precision ). $ shorthand ;
223225 }
224226
225227
226-
227228 public static function getFullModelName ($ modelClassName )
228229 {
229230 if (class_exists ($ modelClassName )) {
@@ -234,7 +235,7 @@ public static function getFullModelName($modelClassName)
234235
235236 return empty ($ namespace )
236237 ? Str::studly ($ modelClassName )
237- : $ namespace . '\\' . Str::studly ($ modelClassName );
238+ : $ namespace. '\\' . Str::studly ($ modelClassName );
238239 }
239240
240241 public static function getUserModelName ()
0 commit comments