Update the README.md with the new features documentation.

This commit is contained in:
3m1n3nc3
2024-07-09 05:01:10 +01:00
parent c652a9cfe0
commit 3ddea7ece2
10 changed files with 38 additions and 52 deletions
+3 -7
View File
@@ -2,9 +2,8 @@
namespace BeyondCode\Comments\Traits;
use Illuminate\Database\Eloquent\Model;
use BeyondCode\Comments\Contracts\Commentator;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphMany;
trait HasComments
@@ -22,7 +21,6 @@ trait HasComments
/**
* Attach a comment to this model.
*
* @param string $comment
* @return \Illuminate\Database\Eloquent\Model
*/
public function comment(string $comment)
@@ -33,8 +31,6 @@ trait HasComments
/**
* Attach a comment to this model as a specific user.
*
* @param Model|null $user
* @param string $comment
* @return \Illuminate\Database\Eloquent\Model
*/
public function commentAsUser(?Model $user, string $comment)
@@ -43,7 +39,7 @@ trait HasComments
$comment = new $commentClass([
'comment' => $comment,
'is_approved' => ($user instanceof Commentator) ? !$user->needsCommentApproval($this) : false,
'is_approved' => ($user instanceof Commentator) ? ! $user->needsCommentApproval($this) : false,
'user_id' => is_null($user) ? null : $user->getKey(),
'commentable_id' => $this->getKey(),
'commentable_type' => get_class(),
@@ -51,4 +47,4 @@ trait HasComments
return $this->comments()->save($comment);
}
}
}