1. Go to this page and download the library: Download rennokki/rating library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rennokki / rating example snippets
use Rennokki\Rating\Traits\CanRate;
use Rennokki\Rating\Contracts\Rater;
class User extends Model implements Rater
{
use CanRate;
...
}
use Rennokki\Rating\Traits\CanBeRated;
use Rennokki\Rating\Contracts\Rateable;
class User extends Model implements Rateable
{
use CanBeRated;
...
}
use Rennokki\Rating\Traits\Rate;
use Rennokki\Rating\Contracts\Rating;
class User extends Model implements Rating
{
use Rate;
//
}
$user = User::find(1);
$user1->rate($user, 10);
$user2->rate($user, 6);
$user->averageRating(); // 8.00, as float
$user->averageRating(User::class); // 8.00, it is equivalent
$page->raters()->get(); // Pages that have rated this page
$page->raters(User::class)->get(); // Users that have rated this page
$user->ratings()->get(); // Users that this user has rated
$user->ratings(Page::class)->get(); // Pages that this user has rated
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.