All Projects → codebyray → Laravel Review Rateable

codebyray / Laravel Review Rateable

Licence: mit
Review & Rating System For Lavavel 5, 6 & 7

Projects that are alternatives of or similar to Laravel Review Rateable

Laravel Reviewable
Adds a reviewable feature to your laravel app.
Stars: ✭ 57 (-20.83%)
Mutual labels:  review, laravel, rating
Rating
rating system for laravel 5
Stars: ✭ 85 (+18.06%)
Mutual labels:  laravel, rating
React Native In App Review
The Google Play In-App Review API, App store rating API lets you prompt users to submit Play Store or App store ratings and reviews without the inconvenience of leaving your app or game.
Stars: ✭ 175 (+143.06%)
Mutual labels:  review, rating
Laravel Likeable
Rate Eloquent models with Likes and Dislikes in Laravel. Development moved to Laravel Love package!
Stars: ✭ 95 (+31.94%)
Mutual labels:  laravel, rating
solidus reviews
Product review/rating functionality for your Solidus store.
Stars: ✭ 17 (-76.39%)
Mutual labels:  review, rating
React Native Store Review
Rate on App/Play Store directly in your React Native app
Stars: ✭ 437 (+506.94%)
Mutual labels:  review, rating
Rating
Laravel Eloquent Rating allows you to assign ratings to any model.
Stars: ✭ 175 (+143.06%)
Mutual labels:  laravel, rating
Laravel Love
Add Social Reactions to Laravel Eloquent Models. It lets people express how they feel about the content. Fully customizable Weighted Reaction System & Reaction Type System with Like, Dislike and any other custom emotion types. Do you react?
Stars: ✭ 822 (+1041.67%)
Mutual labels:  laravel, rating
Laravel Reactions
Laravel reactions package for implementing reactions (eg: like, dislike, love, emotion, etc) on Eloquent models.
Stars: ✭ 58 (-19.44%)
Mutual labels:  laravel, rating
Mgstarratingview
MGStarRatingView is a view for rating.
Stars: ✭ 70 (-2.78%)
Mutual labels:  rating
Laravel Optimistic Locking
Adds optimistic locking feature to eloquent models.
Stars: ✭ 71 (-1.39%)
Mutual labels:  laravel
Dark Sky Api
PHP Library for the Dark Sky API.
Stars: ✭ 70 (-2.78%)
Mutual labels:  laravel
Rubel
Rubel is a cms built with Laravel and React.
Stars: ✭ 70 (-2.78%)
Mutual labels:  laravel
Eloquent Settings
Eloquent Settings allows you to bind key-value pairs to any Laravel Eloquent model. It supports even casting for boolean, float or integer types.
Stars: ✭ 71 (-1.39%)
Mutual labels:  laravel
Picasso
Laravel Image Management and Optimization Package
Stars: ✭ 70 (-2.78%)
Mutual labels:  laravel
Gtrader
a trading strategy trainer, back-tester and bot
Stars: ✭ 71 (-1.39%)
Mutual labels:  laravel
Laravel Custom Relation
A custom relation for when stock relations aren't enough.
Stars: ✭ 69 (-4.17%)
Mutual labels:  laravel
Attendant
Laravel Valet GUI
Stars: ✭ 69 (-4.17%)
Mutual labels:  laravel
Laravel Micro Manager
Oversee jobs you have put into the queue. Track status, completion % and other job information in real time.
Stars: ✭ 71 (-1.39%)
Mutual labels:  laravel
Elasticquent
Maps Laravel Eloquent models to Elasticsearch types
Stars: ✭ 1,172 (+1527.78%)
Mutual labels:  laravel

Laravel Review Rateable

Review Rateable system for laravel 5, 6, 7 & 8. You can rate your models by:

  • Overall Rating
  • Customer Service Rating
  • Quality Rating
  • Friendly Rating
  • Price Rating

You can also set whether the model being rated is recommended.

Installation

First, pull in the package through Composer.

composer require codebyray/laravel-review-rateable

And then include the service provider within app/config/app.php. Note: If you are running Laravel 5.5+ this will be auto loaded for you.

'providers' => [
    Codebyray\ReviewRateable\ReviewRateableServiceProvider::class
];

At last you need to publish and run the migration.

php artisan vendor:publish --provider="Codebyray\ReviewRateable\ReviewRateableServiceProvider" --tag="migrations"

Run the migration

php artisan migrate

Setup a Model

<?php

namespace App;

use Codebyray\ReviewRateable\Contracts\ReviewRateable;
use Codebyray\ReviewRateable\Traits\ReviewRateable as ReviewRateableTrait;
use Illuminate\Database\Eloquent\Model;

class Post extends Model implements ReviewRateable
{
    use ReviewRateableTrait;
}

Create a rating

When creating a rating you can specify whether the rating is approved or not by adding approved to the array. This is optional and if left out the default is not approved to allow for review before posting.

$user = User::first();
$post = Post::first();

$rating = $post->rating([
    'title' => 'This is a test title',
    'body' => 'And we will add some shit here',
    'customer_service_rating' => 5,
    'quality_rating' => 5,
    'friendly_rating' => 5,
    'pricing_rating' => 5,
    'rating' => 5,
    'recommend' => 'Yes',
    'approved' => true, // This is optional and defaults to false
], $user);

dd($rating);

Update a rating

$rating = $post->updateRating(1, [
    'title' => 'new title',
    'body' => 'new body',
    'customer_service_rating' => 1,
    'quality_rating' => 1,
    'friendly_rating' => 3,
    'pricing_rating' => 4,
    'rating' => 4,
    'recommend' => 'No',
    'approved' => true, // This is optional and defaults to false
]);

Marking review as approved

$rating = $post->updateRating(1, ['approved' => true]);

Delete a rating:

$post->deleteRating(1);

Fetch approved or not approved reviews/ratings for a particular resource

// Get approved ratings
$ratings = $post->getApprovedRatings($post->id, 'desc');

// Get not approved ratings
$ratings = $post->getNotApprovedRatings($post->id, 'desc');

// Get all ratings whether approved or not
$ratings = $post->getAllRatings($post->id, 'desc');

// Get the most recent ratings (limit and sort are optional)
// Limit default is 5, sort default is desc
$ratings = $post->getRecentRatings($post->id, 5, 'desc');

// Get the most recent user ratings (limit and sort are optional)
// Limit default is 5, approved default is true, sort default is desc
$userRatings = $post->getRecentUserRatings($user->id, 5, true, 'desc');

Fetch the average rating:

// Get Overall Average Rating
$post->averageRating()

// Get Customer Service Average Rating
$post->averageCustomerServiceRating()

// Get Quality Average Rating
$post->averageQualityRating()

// Get Friendly Average Rating
$post->averageFriendlyRating()

// Get Price Average Rating
$post->averagePricingRating()

or

$post->averageRating(2) //round to 2 decimal place
$post->averageRating(null, true) //get only approved average rating 

Get all ratings:

$post = Post::first();

$ratings = $post->getAllRatings($post->id);

Count total rating:

$post->countRating()

Fetch the rating percentage.

This is also how you enforce a maximum rating value.

$post->ratingPercent()

$post->ratingPercent(10)); // Ten star rating system
// Note: The value passed in is treated as the maximum allowed value.
// This defaults to 5 so it can be called without passing a value as well.

Note

This is a fork from Trexology's - Original Code - laravel-reviewRateable .

Please note that this code is not used in the original and is not maintained.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].