@@ -52,8 +52,9 @@ After publishing, run the `php artisan migrate` command.
5252
5353## Usage
5454
55- First of all , you need to use two traits:
55+ To enable scoring functionality , you need to use two traits:
5656
57+ On the model giving the score (e.g. ` User ` ):
5758``` php
5859use Binafy\LaravelScore\Traits\InteractWithScore;
5960use \Illuminate\Database\Eloquent\Model;
@@ -64,7 +65,7 @@ class User extends Model
6465}
6566```
6667
67- And your model that want to give score to it :
68+ On the model receiving the score (e.g. ` Photo ` ) :
6869
6970``` php
7071use Binafy\LaravelScore\Traits\Scoreable;
@@ -78,7 +79,7 @@ class Photo extends Model
7879
7980### Add Score
8081
81- For giving a score to scoreable, you can use ` addScore() ` method :
82+ To give a positive score to a scoreable model :
8283
8384``` php
8485$user->addScore(
@@ -90,7 +91,7 @@ $user->addScore(
9091
9192### Add Negative Score
9293
93- If you want to add negative score to scoreable, you can use ` addNegativeScore() ` method :
94+ To assign a negative score:
9495
9596``` php
9697$user->addNegativeScore(
@@ -101,7 +102,7 @@ $user->addNegativeScore(
101102
102103### Checking Scores
103104
104- If you want to check whether model has been scored to by specific user, you can use ` isScored() ` and ` hasScored() ` methods :
105+ You can check whether a model has already been scored by a specific user:
105106
106107``` php
107108$user->hasScored(
@@ -116,18 +117,19 @@ $photo->isScored(
116117
117118### Count Scores
118119
119- For get count of scores of one scoreable, you can use ` getScoresCount() ` method :
120+ To get the total number of scores for a model :
120121
121122``` php
122123$photo->getScoresCount(): int;
123124```
124125
125126### Delete score
126127
127- For deleting a score, you may use ` removeScore() ` method :
128+ To remove an existing score :
128129
129130``` php
130131$user->removeScore(Model $scoreable): bool;
132+
131133$photo->removeScore(?int $userId = null): bool;
132134```
133135
0 commit comments