From a49c7492c4ab7b3c322b89234ec87e9ccec7d57a Mon Sep 17 00:00:00 2001 From: Charlie Date: Fri, 20 Mar 2020 06:02:08 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Listener/AddPostReactionsRelationship.php | 6 +++-- src/Listener/SaveReactionsToDatabase.php | 26 +++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/Listener/AddPostReactionsRelationship.php b/src/Listener/AddPostReactionsRelationship.php index c8e168d..b320fef 100755 --- a/src/Listener/AddPostReactionsRelationship.php +++ b/src/Listener/AddPostReactionsRelationship.php @@ -59,8 +59,10 @@ public function subscribe(Dispatcher $events) public function getModelRelationship(GetModelRelationship $event) { if ($event->isRelationship(Post::class, 'reactions')) { - return $event->model->belongsToMany(Reaction::class, 'post_reactions', 'post_id')->withPivot('reaction_id', - 'user_id'); + return $event->model->belongsToMany(Reaction::class, 'post_reactions', 'post_id')->withPivot( + 'reaction_id', + 'user_id' + ); } } diff --git a/src/Listener/SaveReactionsToDatabase.php b/src/Listener/SaveReactionsToDatabase.php index 71ca893..e081915 100755 --- a/src/Listener/SaveReactionsToDatabase.php +++ b/src/Listener/SaveReactionsToDatabase.php @@ -82,11 +82,21 @@ public function whenSaving(Saving $event) $this->validateReaction($reactionType); if (class_exists('FoF\Gamification\Listeners\SaveVotesToDatabase') && $reactionType == $this->settings->get('fof-reactions.convertToUpvote')) { - app()->make('FoF\Gamification\Listeners\SaveVotesToDatabase')->vote($post, $isDownvoted = false, - $isUpvoted = true, $actor, $post->user); + app()->make('FoF\Gamification\Listeners\SaveVotesToDatabase')->vote( + $post, + $isDownvoted = false, + $isUpvoted = true, + $actor, + $post->user + ); } elseif (class_exists('FoF\Gamification\Listeners\SaveVotesToDatabase') && $reactionType == $this->settings->get('fof-reactions.convertToDownvote')) { - app()->make('FoF\Gamification\Listeners\SaveVotesToDatabase')->vote($post, $isDownvoted = true, - $isUpvoted = false, $actor, $post->user); + app()->make('FoF\Gamification\Listeners\SaveVotesToDatabase')->vote( + $post, + $isDownvoted = true, + $isUpvoted = false, + $actor, + $post->user + ); } elseif (class_exists('Flarum\Likes\Listener\SaveLikesToDatabase') && $reactionType == $this->settings->get('fof-reactions.convertToLike')) { $liked = $post->likes()->where('user_id', $actor->id)->exists(); if ($liked) { @@ -130,10 +140,10 @@ public function pushNewReaction($reaction, $actor, $post, $identifier) $pusher = $this->getPusher(); $pusher->trigger('public', 'newReaction', [ - 'reaction' => $reaction, - 'postId' => $post->id, - 'userId' => $actor->id, - 'identifier' => $identifier + 'reaction' => $reaction, + 'postId' => $post->id, + 'userId' => $actor->id, + 'identifier' => $identifier, ]); }