WIP: `CanBeActor` trait.
Hey!
While implementing rating in my platform I notice there's some missing feature.
First of all, let me explain why we need another trait:
existing traits allow us to make easily 2 point interactions where users interact with something. this is all good use case but when you would like to implement something like the collective score for the provider.
Case example.
there's consumer, job, and the provider you would like to give rate to provider but if you directly rate the provider without mid entity you can only do that once. which is game blocker;
A better way to implement this would be user rates job and someone gets credits from it.
so introduce nullableMorph('actor') in interactions table.
where you can define who the actor getting credits from.
through this,
the provider could have an average rating base on the jobs he has done. the consumer could have an average rating base on the jobs created.
I don't think this branch is mature enough to merge in yet but would love to take opinions.
Cheers 🍻
example method on Models\User.php
public function getJobSuccessRate()
{
$totalJobSuccessRate = $this->getRatesVia(
[Job::class]
)->average(
'relation_value'
);
return Interaction::numberToReadable(
$totalJobSuccessRate
);
}
an example method to rate
$jobSession->job->author->rate(
$jobSession,
5,
JobSession::RATING_GENERAL,
null,
$jobSession->developer
);
In case of confirmation; I would love to have someone help me to add the documentation part. This could be a nice first-contribute case.
WOW! this is a big one, thanks for your time and efforts, give me sometime to examine it extensively
Thanks again!
Any feedback on this ?
So sorry for the late reply, please give me sometime as I am about to finish a very heavy work and be totally free to maintain this package again 😍
@mkwsra thank you for this beautiful package of yours.
@Necmttn I am a newbie with this package too and I just digged in with the package just recently.
I assume that the actor has a migration? but I cant see any.
simply bro @Necmttn put the rating trait on the job instead of provider where consumer can rate each job (job related to provider)....
It seems like the content is outdated, and I do not recall the context. Therefore, I am closing the PR.