Skip to content

Commit

Permalink
Merge pull request #2 from inpin/rename_base_test_case_class
Browse files Browse the repository at this point in the history
rename method of loggedInUser to getLoggedInUserForLaraLike to avoid …
  • Loading branch information
enourinick authored Jun 5, 2018
2 parents a9187fd + 7ac3854 commit 1b2b4c8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Likeable.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function bootLikeable()
public function scopeWhereLikedBy($query, $guard = null, $type = 'like')
{
if (!($guard instanceof User)) {
$guard = $this->loggedInUser($guard);
$guard = $this->getLoggedInUserForLaraLike($guard);
}

return $query->whereHas('likes', function ($query) use ($type, $guard) {
Expand Down Expand Up @@ -84,7 +84,7 @@ public function likeCounter()
public function like($guard = null, $type = 'like')
{
if (!($guard instanceof User) && (is_string($guard) || is_null($guard))) {
$guard = $this->loggedInUser($guard);
$guard = $this->getLoggedInUserForLaraLike($guard);
}

if ($guard instanceof User) {
Expand Down Expand Up @@ -113,7 +113,7 @@ public function like($guard = null, $type = 'like')
public function unlike($guard = null, $type = 'like')
{
if (!($guard instanceof User) && (is_string($guard) || is_null($guard))) {
$guard = $this->loggedInUser($guard);
$guard = $this->getLoggedInUserForLaraLike($guard);
}

if ($guard instanceof User) {
Expand Down Expand Up @@ -145,7 +145,7 @@ public function unlike($guard = null, $type = 'like')
public function liked($guard = null, $type = 'like')
{
if (!($guard instanceof User)) {
$guard = $this->loggedInUser($guard);
$guard = $this->getLoggedInUserForLaraLike($guard);
}

return $this->likes()
Expand Down Expand Up @@ -209,7 +209,7 @@ private function decrementLikeCount($type = 'like')
*
* @return \Illuminate\Contracts\Auth\Authenticatable|null
*/
public function loggedInUser($guard)
public function getLoggedInUserForLaraLike($guard)
{
return auth($guard)->user();
}
Expand Down

0 comments on commit 1b2b4c8

Please sign in to comment.