diff --git a/src/Traits/Actions/Bookmark/isBookmarkable.php b/src/Traits/Actions/Bookmark/isBookmarkable.php index a3029f1..1febc66 100644 --- a/src/Traits/Actions/Bookmark/isBookmarkable.php +++ b/src/Traits/Actions/Bookmark/isBookmarkable.php @@ -2,7 +2,7 @@ namespace Pharaonic\Laravel\Users\Traits\Actions\Bookmark; -use Illuminate\Database\Eloquent\Model; +use Illuminate\Contracts\Auth\Authenticatable; use Pharaonic\Laravel\Users\Models\Actions\Bookmark; trait isBookmarkable @@ -10,10 +10,10 @@ trait isBookmarkable /** * Get Bookmark Object * - * @param Model $bookmarker + * @param Authenticatable $bookmarker * @return Bookmark|null */ - public function getBookmark(Model $bookmarker) + public function getBookmark(Authenticatable $bookmarker) { return $this->bookmarks()->where(['bookmarker_id' => $bookmarker->getKey(), 'bookmarker_type' => get_class($bookmarker)])->first(); } @@ -21,11 +21,11 @@ public function getBookmark(Model $bookmarker) /** * Bookmark with a Model * - * @param Model $bookmarker + * @param Authenticatable $bookmarker * @param array|null $data * @return boolean */ - public function bookmarkBy(Model $bookmarker, array $data = null) + public function bookmarkBy(Authenticatable $bookmarker, array $data = null) { if ($bookmark = $this->getBookmark($bookmarker)) { return $bookmark->update(['data' => $data]); @@ -35,12 +35,12 @@ public function bookmarkBy(Model $bookmarker, array $data = null) } /** - * Unbookmark with a Model + * Un-bookmark with a Model * - * @param Model $bookmarker + * @param Authenticatable $bookmarker * @return boolean */ - public function unBookmarkBy(Model $bookmarker) + public function unBookmarkBy(Authenticatable $bookmarker) { if ($bookmark = $this->getBookmark($bookmarker)) return $bookmark->delete(); @@ -51,10 +51,10 @@ public function unBookmarkBy(Model $bookmarker) /** * Has Bookmarked By Bookmarker * - * @param Model $bookmarker + * @param Authenticatable $bookmarker * @return boolean */ - public function bookmarkedBy(Model $bookmarker) + public function bookmarkedBy(Authenticatable $bookmarker) { return $this->bookmarks()->where(['bookmarker_id' => $bookmarker->getKey(), 'bookmarker_type' => get_class($bookmarker)])->exists(); } diff --git a/src/Traits/Actions/Comment/isCommentable.php b/src/Traits/Actions/Comment/isCommentable.php index 368a64a..62e7680 100644 --- a/src/Traits/Actions/Comment/isCommentable.php +++ b/src/Traits/Actions/Comment/isCommentable.php @@ -2,7 +2,7 @@ namespace Pharaonic\Laravel\Users\Traits\Actions\Comment; -use Illuminate\Database\Eloquent\Model; +use Illuminate\Contracts\Auth\Authenticatable; use Pharaonic\Laravel\Users\Models\Actions\Comment; trait isCommentable @@ -10,11 +10,11 @@ trait isCommentable /** * Comment with a Model * - * @param Model $commenter + * @param Authenticatable $commenter * @param string $comment * @return boolean */ - public function commentBy(Model $commenter, string $body) + public function commentBy(Authenticatable $commenter, string $body) { return $this->comments()->make(['commentable' => $this, 'comment' => $body])->commenter()->associate($commenter)->save(); } @@ -22,10 +22,10 @@ public function commentBy(Model $commenter, string $body) /** * Has Commented By Commenter * - * @param Model $commenter + * @param Authenticatable $commenter * @return boolean */ - public function commentedBy(Model $commenter) + public function commentedBy(Authenticatable $commenter) { return $this->comments()->where(['commenter_id' => $commenter->getKey(), 'commenter_type' => get_class($commenter)])->exists(); } diff --git a/src/Traits/Actions/Favourite/isFavourable.php b/src/Traits/Actions/Favourite/isFavourable.php index 044b308..8b96d8e 100644 --- a/src/Traits/Actions/Favourite/isFavourable.php +++ b/src/Traits/Actions/Favourite/isFavourable.php @@ -2,7 +2,7 @@ namespace Pharaonic\Laravel\Users\Traits\Actions\Favourite; -use Illuminate\Database\Eloquent\Model; +use Illuminate\Contracts\Auth\Authenticatable; use Pharaonic\Laravel\Users\Models\Actions\Favourite; trait isFavourable @@ -10,10 +10,10 @@ trait isFavourable /** * Favourite with a Model * - * @param Model $favorer + * @param Authenticatable $favorer * @return boolean */ - public function favouriteBy(Model $favorer) + public function favouriteBy(Authenticatable $favorer) { if ($this->favouredBy($favorer)) return true; @@ -24,10 +24,10 @@ public function favouriteBy(Model $favorer) /** * Unfavourite with a Model * - * @param Model $favorer + * @param Authenticatable $favorer * @return boolean */ - public function unFavouriteBy(Model $favorer) + public function unFavouriteBy(Authenticatable $favorer) { if ($favourite = $this->favourites()->where(['favorer_id' => $favorer->getKey(), 'favorer_type' => get_class($favorer)])->first()) return $favourite->delete(); @@ -38,10 +38,10 @@ public function unFavouriteBy(Model $favorer) /** * Has Favoured By favour * - * @param Model $favorer + * @param Authenticatable $favorer * @return boolean */ - public function favouredBy(Model $favorer) + public function favouredBy(Authenticatable $favorer) { return $this->favourites()->where(['favorer_id' => $favorer->getKey(), 'favorer_type' => get_class($favorer)])->exists(); } diff --git a/src/Traits/Actions/Follow/isFollowable.php b/src/Traits/Actions/Follow/isFollowable.php index c538ce1..d821ac0 100644 --- a/src/Traits/Actions/Follow/isFollowable.php +++ b/src/Traits/Actions/Follow/isFollowable.php @@ -2,7 +2,7 @@ namespace Pharaonic\Laravel\Users\Traits\Actions\Follow; -use Illuminate\Database\Eloquent\Model; +use Illuminate\Contracts\Auth\Authenticatable; use Pharaonic\Laravel\Users\Models\Actions\Follow; trait isFollowable @@ -10,10 +10,10 @@ trait isFollowable /** * Follow with a Model * - * @param Model follower + * @param Authenticatable follower * @return boolean */ - public function followBy(Model $follower) + public function followBy(Authenticatable $follower) { if ($this->followedBy($follower)) return true; @@ -22,12 +22,12 @@ public function followBy(Model $follower) } /** - * Unfollow with a Model + * Un-follow with a Model * - * @param Model follower + * @param Authenticatable follower * @return boolean */ - public function unFollowBy(Model $follower) + public function unFollowBy(Authenticatable $follower) { if ($follow = $this->follows()->where(['follower_id' => $follower->getKey(), 'follower_type' => get_class($follower)])->first()) return $follow->delete(); @@ -38,10 +38,10 @@ public function unFollowBy(Model $follower) /** * Has Followed By Follower * - * @param Model follower + * @param Authenticatable follower * @return boolean */ - public function followedBy(Model $follower) + public function followedBy(Authenticatable $follower) { return $this->follows()->where(['follower_id' => $follower->getKey(), 'follower_type' => get_class($follower)])->exists(); } diff --git a/src/Traits/Actions/Like/isLikeable.php b/src/Traits/Actions/Like/isLikeable.php index b9b90e3..dcea022 100644 --- a/src/Traits/Actions/Like/isLikeable.php +++ b/src/Traits/Actions/Like/isLikeable.php @@ -2,7 +2,7 @@ namespace Pharaonic\Laravel\Users\Traits\Actions\Like; -use Illuminate\Database\Eloquent\Model; +use Illuminate\Contracts\Auth\Authenticatable; use Pharaonic\Laravel\Users\Models\Actions\Like; trait isLikeable @@ -10,10 +10,10 @@ trait isLikeable /** * Like with a Model * - * @param Model $liker + * @param Authenticatable $liker * @return boolean */ - public function likeBy(Model $liker) + public function likeBy(Authenticatable $liker) { if ($this->likedBy($liker)) return true; @@ -24,10 +24,10 @@ public function likeBy(Model $liker) /** * Unlike with a Model * - * @param Model $liker + * @param Authenticatable $liker * @return boolean */ - public function unLikeBy(Model $liker) + public function unLikeBy(Authenticatable $liker) { if ($like = $this->likes()->where(['liker_id' => $liker->getKey(), 'liker_type' => get_class($liker)])->first()) return $like->delete(); @@ -38,10 +38,10 @@ public function unLikeBy(Model $liker) /** * Has Liked By Liker * - * @param Model $liker + * @param Authenticatable $liker * @return boolean */ - public function likedBy(Model $liker) + public function likedBy(Authenticatable $liker) { return $this->likes()->where(['liker_id' => $liker->getKey(), 'liker_type' => get_class($liker)])->exists(); } diff --git a/src/Traits/Actions/Review/isReviewable.php b/src/Traits/Actions/Review/isReviewable.php index 2d0fa96..39dea7a 100644 --- a/src/Traits/Actions/Review/isReviewable.php +++ b/src/Traits/Actions/Review/isReviewable.php @@ -2,7 +2,7 @@ namespace Pharaonic\Laravel\Users\Traits\Actions\Review; -use Illuminate\Database\Eloquent\Model; +use Illuminate\Contracts\Auth\Authenticatable; use Pharaonic\Laravel\Users\Models\Actions\Review; trait isReviewable @@ -10,10 +10,10 @@ trait isReviewable /** * Get Review Object * - * @param Model $reviewer + * @param Authenticatable $reviewer * @return Vote|null */ - public function getReview(Model $reviewer) + public function getReview(Authenticatable $reviewer) { return $this->reviews()->where(['reviewer_id' => $reviewer->getKey(), 'reviewer_type' => get_class($reviewer)])->first(); } @@ -21,12 +21,12 @@ public function getReview(Model $reviewer) /** * Review Model By reviewer * - * @param Model $reviewer + * @param Authenticatable $reviewer * @param float $rate * @param string|null $comment * @return boolean */ - public function reviewBy(Model $reviewer, float $rate = 0, string $comment = null) + public function reviewBy(Authenticatable $reviewer, float $rate = 0, string $comment = null) { if ($review = $this->getReview($reviewer)) { return $review->update([ @@ -45,10 +45,10 @@ public function reviewBy(Model $reviewer, float $rate = 0, string $comment = nul /** * UnReview Model By reviewer * - * @param Model $reviewer + * @param Authenticatable $reviewer * @return boolean */ - public function unReviewBy(Model $reviewer) + public function unReviewBy(Authenticatable $reviewer) { if ($review = $this->getReview($reviewer)) return $review->delete(); @@ -59,10 +59,10 @@ public function unReviewBy(Model $reviewer) /** * Has Reviewed By reviewer * - * @param Model $reviewer + * @param Authenticatable $reviewer * @return boolean */ - public function reviewedBy(Model $reviewer) + public function reviewedBy(Authenticatable $reviewer) { return $this->reviews()->where(['reviewer_id' => $reviewer->getKey(), 'reviewer_type' => get_class($reviewer)])->exists(); } diff --git a/src/Traits/Actions/Subscribe/isSubscribable.php b/src/Traits/Actions/Subscribe/isSubscribable.php index 6079192..ff83029 100644 --- a/src/Traits/Actions/Subscribe/isSubscribable.php +++ b/src/Traits/Actions/Subscribe/isSubscribable.php @@ -2,7 +2,7 @@ namespace Pharaonic\Laravel\Users\Traits\Actions\Subscribe; -use Illuminate\Database\Eloquent\Model; +use Illuminate\Contracts\Auth\Authenticatable; use Pharaonic\Laravel\Users\Models\Actions\Subscribe; trait isSubscribable @@ -10,10 +10,10 @@ trait isSubscribable /** * Subscribe with a Model * - * @param Model $subscriber + * @param Authenticatable $subscriber * @return boolean */ - public function subscribeBy(Model $subscriber) + public function subscribeBy(Authenticatable $subscriber) { if ($this->subscribedBy($subscriber)) return true; @@ -24,10 +24,10 @@ public function subscribeBy(Model $subscriber) /** * Unsubscribe with a Model * - * @param Model $subscriber + * @param Authenticatable $subscriber * @return boolean */ - public function unSubscribeBy(Model $subscriber) + public function unSubscribeBy(Authenticatable $subscriber) { if ($subscription = $this->subscriptions()->where(['subscriber_id' => $subscriber->getKey(), 'subscriber_type' => get_class($subscriber)])->first()) return $subscription->delete(); @@ -38,10 +38,10 @@ public function unSubscribeBy(Model $subscriber) /** * Has Subscribed By Subscriber * - * @param Model $subscriber + * @param Authenticatable $subscriber * @return boolean */ - public function subscribedBy(Model $subscriber) + public function subscribedBy(Authenticatable $subscriber) { return $this->subscriptions()->where(['subscriber_id' => $subscriber->getKey(), 'subscriber_type' => get_class($subscriber)])->exists(); } diff --git a/src/Traits/Actions/Vote/isVotable.php b/src/Traits/Actions/Vote/isVotable.php index 76eb4ef..211a45f 100644 --- a/src/Traits/Actions/Vote/isVotable.php +++ b/src/Traits/Actions/Vote/isVotable.php @@ -2,7 +2,7 @@ namespace Pharaonic\Laravel\Users\Traits\Actions\Vote; -use Illuminate\Database\Eloquent\Model; +use Illuminate\Contracts\Auth\Authenticatable; use Pharaonic\Laravel\Users\Models\Actions\Vote; trait isVotable @@ -10,10 +10,10 @@ trait isVotable /** * Get Vote Object * - * @param Model $voter + * @param Authenticatable $voter * @return Vote|null */ - public function getVote(Model $voter) + public function getVote(Authenticatable $voter) { return $this->votes()->where(['voter_id' => $voter->getKey(), 'voter_type' => get_class($voter)])->first(); } @@ -21,10 +21,10 @@ public function getVote(Model $voter) /** * VoteUp with a Model * - * @param Model $voter + * @param Authenticatable $voter * @return boolean */ - public function voteUpBy(Model $voter) + public function voteUpBy(Authenticatable $voter) { if ($vote = $this->getVote($voter)) { return $vote->update(['vote' => true]); @@ -36,10 +36,10 @@ public function voteUpBy(Model $voter) /** * VoteDown with a Model * - * @param Model $voter + * @param Authenticatable $voter * @return boolean */ - public function voteDownBy(Model $voter) + public function voteDownBy(Authenticatable $voter) { if ($vote = $this->getVote($voter)) { return $vote->update(['vote' => false]); @@ -51,10 +51,10 @@ public function voteDownBy(Model $voter) /** * Unvote with a Model * - * @param Model $voter + * @param Authenticatable $voter * @return boolean */ - public function unVoteBy(Model $voter) + public function unVoteBy(Authenticatable $voter) { if ($vote = $this->getVote($voter)) return $vote->delete(); @@ -65,10 +65,10 @@ public function unVoteBy(Model $voter) /** * Has Voted By Voter * - * @param Model $voter + * @param Authenticatable $voter * @return boolean */ - public function votedBy(Model $voter) + public function votedBy(Authenticatable $voter) { return $this->votes()->where(['voter_id' => $voter->getKey(), 'voter_type' => get_class($voter)])->exists(); }