Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

[FIX] updated to be compatible with Laravel's Custom Polymorphic Types. #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 2
runs: 1
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
],
"require": {
"php": "^7.1.3",
"illuminate/database": "~5.5.0|~5.6.0|~5.7.0"
"illuminate/database": "~5.5.0|~5.6.0|~5.7.0|~5.8.0"
},
"require-dev": {
"phpunit/phpunit": "^7.4",
"orchestra/testbench": "~3.5.0|~3.6.0|~3.7.0",
"orchestra/testbench": "~3.5.0|~3.6.0|~3.7.0|~3.8.0",
"fzaninotto/faker": "^1.8",
"scrutinizer/ocular": "^1.5"
},
Expand Down
4 changes: 2 additions & 2 deletions src/CanComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function comment(Commentable $commentable, string $commentText = '', int
'rate' => $commentable->canBeRated() ? $rate : null,
'approved' => $commentable->mustBeApproved() && !$this->canCommentWithoutApprove() ? false : true,
'commented_id' => $this->primaryId(),
'commented_type' => get_class(),
'commented_type' => $this->getMorphClass(),
]);

$commentable->comments()->save($comment);
Expand All @@ -41,7 +41,7 @@ public function hasCommentsOn(Commentable $commentable): bool
return $this->comments()
->where([
'commentable_id' => $commentable->primaryId(),
'commentable_type' => get_class($commentable),
'commentable_type' => $commentable->getMorphClass(),
])
->exists();
}
Expand Down