mohamednagy / laravel-rating Goto Github PK
View Code? Open in Web Editor NEWLaravel package that allows you to rate, like & dislike and vote(+1,-1) your models with a simple and clear ways
License: MIT License
Laravel package that allows you to rate, like & dislike and vote(+1,-1) your models with a simple and clear ways
License: MIT License
Using version ^1.2 for nagy/laravel-rating
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for nagy/laravel-rating ^1.2 -> satisfiable by nagy/laravel-rating[1.2].
- Conclusion: remove laravel/framework v6.0.3
- Conclusion: don't install laravel/framework v6.0.3
- nagy/laravel-rating 1.2 requires illuminate/database 5.* -> satisfiable by laravel/framework[5.4.x-dev, 5.5.x-dev, 5.6.x-dev, 5.7.x-dev, 5.8.x-dev], illuminate/database[5.0.x-dev, 5.1.x-dev, 5.2.x-dev, 5.3.x-dev, 5.4.x-dev, 5.5.x-dev, 5.6.x-dev, 5.7.17, 5.7.18, 5.7.19, 5.7.x-dev, 5.8.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.27, v5.0.28, v5.0.33, v5.0.4, v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1.8, v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.23, v5.3.4, v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9, v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28, v5.5.33, v5.5.34, v5.5.35, v5.5.36, v5.5.37, v5.5.39, v5.5.40, v5.5.41, v5.5.43, v5.5.44, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.39, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.4, v5.8.8, v5.8.9].
- Can only install one of: laravel/framework[5.4.x-dev, v6.0.3].
- Can only install one of: laravel/framework[5.5.x-dev, v6.0.3].
- Can only install one of: laravel/framework[5.6.x-dev, v6.0.3].
- Can only install one of: laravel/framework[5.7.x-dev, v6.0.3].
- Can only install one of: laravel/framework[5.8.x-dev, v6.0.3].
- don't install illuminate/database 5.7.17|don't install laravel/framework v6.0.3
- don't install illuminate/database 5.7.18|don't install laravel/framework v6.0.3
- don't install illuminate/database 5.7.19|don't install laravel/framework v6.0.3
- don't install illuminate/database 5.7.x-dev|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.0|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.1|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.10|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.11|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.15|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.2|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.20|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.21|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.22|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.23|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.26|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.27|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.28|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.3|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.4|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.5|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.6|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.7|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.8|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.7.9|don't install laravel/framework v6.0.3
- don't install illuminate/database 5.8.x-dev|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.0|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.11|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.12|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.14|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.15|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.17|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.18|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.19|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.2|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.20|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.22|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.24|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.27|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.28|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.29|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.3|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.30|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.31|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.32|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.33|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.34|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.35|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.4|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.8|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.8.9|don't install laravel/framework v6.0.3
- don't install illuminate/database 5.4.x-dev|don't install laravel/framework v6.0.3
- don't install illuminate/database 5.5.x-dev|don't install laravel/framework v6.0.3
- don't install illuminate/database 5.6.x-dev|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.4.0|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.4.13|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.4.17|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.4.19|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.4.27|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.4.36|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.4.9|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.0|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.16|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.17|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.2|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.28|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.33|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.34|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.35|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.36|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.37|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.39|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.40|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.41|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.43|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.5.44|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.0|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.1|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.10|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.11|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.12|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.13|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.14|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.15|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.16|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.17|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.19|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.2|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.20|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.21|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.22|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.23|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.24|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.25|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.26|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.27|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.28|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.29|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.3|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.30|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.31|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.32|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.33|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.34|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.35|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.36|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.37|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.38|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.39|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.4|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.5|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.6|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.7|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.8|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.6.9|don't install laravel/framework v6.0.3
- don't install illuminate/database 5.0.x-dev|don't install laravel/framework v6.0.3
- don't install illuminate/database 5.1.x-dev|don't install laravel/framework v6.0.3
- don't install illuminate/database 5.2.x-dev|don't install laravel/framework v6.0.3
- don't install illuminate/database 5.3.x-dev|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.0.0|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.0.22|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.0.25|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.0.26|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.0.27|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.0.28|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.0.33|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.0.4|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.1.1|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.1.13|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.1.16|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.1.2|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.1.20|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.1.22|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.1.25|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.1.28|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.1.30|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.1.31|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.1.41|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.1.6|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.1.8|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.0|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.19|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.21|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.24|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.25|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.26|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.27|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.28|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.31|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.32|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.37|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.43|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.45|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.6|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.2.7|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.3.0|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.3.16|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.3.23|don't install laravel/framework v6.0.3
- don't install illuminate/database v5.3.4|don't install laravel/framework v6.0.3
- Installation request for laravel/framework (locked at v6.0.3, required as ^6.0) -> satisfiable by laravel/framework[v6.0.3].
Installation failed, reverting ./composer.json to its original content.
Missing support for laravel 8
can you add comment column please ?
thanks
It would be useful to allow a user to remove their rating by sending null
, false
or -1
in along the rate()
method. This should delete the corresponding row in DB or at least adapt the count and average by ignoring zero ratings.
ex:
$user->rate($model, null);
or by adding a new method:
ex:
$user->unrate($model);
In most UI, it's possible to remove the stars, but as now, it's only possible to zero rate, distorting average.
Thank you in advance!
getting this error when making user can rate and rateable at the same time
Trait method Nagy\LaravelRating\Traits\Rate\Rateable::ratings has not been applied as App\Models\User::ratings, because of collision with Nagy\LaravelRating\Traits\Rate\CanRate::ratings"
when i want see likes count gave this message:
BadMethodCallException
Call to undefined method App\User::ratings()
Am I correct in reading this that v1.2 requires Laravel 6.x? I may be reading this wrong - I've always found composer messages to be confusing when it comes to package dependencies:
Problem 1
- Conclusion: remove laravel/framework v5.8.35
- Conclusion: don't install laravel/framework v5.8.35
- nagy/laravel-rating v1.2 requires illuminate/support 6.* -> satisfiable by laravel/framework[6.x-dev], illuminate/support[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.2.0, v6.3.0, v6.4.1].
- nagy/laravel-rating v1.3 requires illuminate/support 6.* -> satisfiable by laravel/framework[6.x-dev], illuminate/support[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.2.0, v6.3.0, v6.4.1].
- Can only install one of: laravel/framework[6.x-dev, v5.8.35].
- don't install illuminate/support 6.x-dev|don't install laravel/framework v5.8.35
- don't install illuminate/support v6.0.0|don't install laravel/framework v5.8.35
- don't install illuminate/support v6.0.1|don't install laravel/framework v5.8.35
- don't install illuminate/support v6.0.2|don't install laravel/framework v5.8.35
- don't install illuminate/support v6.0.3|don't install laravel/framework v5.8.35
- don't install illuminate/support v6.0.4|don't install laravel/framework v5.8.35
- don't install illuminate/support v6.1.0|don't install laravel/framework v5.8.35
- don't install illuminate/support v6.2.0|don't install laravel/framework v5.8.35
- don't install illuminate/support v6.3.0|don't install laravel/framework v5.8.35
- don't install illuminate/support v6.4.1|don't install laravel/framework v5.8.35
- Installation request for laravel/framework (locked at v5.8.35, required as 5.8.*) -> satisfiable by laravel/framework[v5.8.35].
- Installation request for nagy/laravel-rating ^1.2 -> satisfiable by nagy/laravel-rating[v1.2, v1.3].
Hi, thanks for maintaining this good package! after running php artisan migrate
I got this error :
Migrating: 2021_04_20_143520_add_type_column_to_ratings_table
Illuminate\Database\QueryException
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'rating.ratings' doesn't exist (SQL: alter table
ratings
addtype
varchar(255) null)at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
674▕ // If an exception occurs when attempting to run a query, we'll format the error
675▕ // message to include the bindings with SQL, which will make this exception a
676▕ // lot more helpful to the developer instead of just the database's errors.
677▕ catch (Exception $e) {
➜ 678▕ throw new QueryException(
679▕ $query, $this->prepareBindings($bindings), $e
680▕ );
681▕ }
682▕• A table was not found: You might have forgotten to run your migrations. You can run your migrations using
php artisan migrate
.
https://laravel.com/docs/master/migrations#running-migrations+9 vendor frames
10 database/migrations/2021_04_20_143520_add_type_column_to_ratings_table.php:13
Illuminate\Support\Facades\Facade::__callStatic()+21 vendor frames
32 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
The problem is : LaravelRatingServiceProvider.php
we got this :
__DIR__.'/../database/migrations/create_ratings_table.php' => app()->basePath().'/database/migrations/'.date('Y_m_d_His').'_create_ratings_table.php',
__DIR__.'/../database/migrations/add_type_column_to_ratings_table.php' => app()->basePath().'/database/migrations/'.date('Y_m_d_His').'_add_type_column_to_ratings_table.php',
generating migration prefixes in the same time! so add_type_column_to_ratings_table.php migrates before create_ratings_table.php
The solution is : merging migrations in one file
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateLaravelRatingTable extends Migration
{
public function up()
{
Schema::create('ratings', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('type')->nullable();
$table->morphs('model');
$table->morphs('rateable');
$table->decimal('value', 2, 1);
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('ratings');
}
}
Do you have any idea about making review together with this pacakge?
Hi there
The problem is when used Rate and Like together in the posts, they replace in database.
After #27 ; and solving the problem when i run php artisan migrate
I've got this error:
Symfony\Component\ErrorHandler\Error\FatalError
Cannot declare class CreateLaravelRatingTable, because the name is already in use
at database/migrations/2021_04_21_015322_create_ratings_table.php:7
3▕ use Illuminate\Database\Migrations\Migration;
4▕ use Illuminate\Database\Schema\Blueprint;
5▕ use Illuminate\Support\Facades\Schema;
6▕
➜ 7▕ class CreateLaravelRatingTable extends Migration
8▕ {
9▕ public function up()
10▕ {
11▕ Schema::create('ratings', function (Blueprint $table) {Whoops\Exception\ErrorException
Cannot declare class CreateLaravelRatingTable, because the name is already in use
at database/migrations/2021_04_21_015322_create_ratings_table.php:7
3▕ use Illuminate\Database\Migrations\Migration;
4▕ use Illuminate\Database\Schema\Blueprint;
5▕ use Illuminate\Support\Facades\Schema;
6▕
➜ 7▕ class CreateLaravelRatingTable extends Migration
8▕ {
9▕ public function up()
10▕ {
11▕ Schema::create('ratings', function (Blueprint $table) {+1 vendor frames
2 [internal]:0
Whoops\Run::handleShutdown()
The problem is : CreateLaravelRatingTable class name for create_ratings_table migration!
The solution is : change migration class name to CreateRatingsTable
I have morph maps in my app, and when i rate something, they get ignored so the relations doesnt work and i cant get rating data.... lost hours trying to figure this out... im pretty new to laravel so not sure if im doing something wrong or is this package that is just ignoring the morph maps data, ill have to disable them for now ..........
Trait references incorrect in documentation. (missing additional subdirectory)
For apply rating functionalities:
use Nagy\LaravelRating\Traits\Rate\CanRate;
use Nagy\LaravelRating\Traits\Vote\CanVote;
use Nagy\LaravelRating\Traits\Like\CanLike;
For rating functionalities:
use Nagy\LaravelRating\Traits\Rate\Rateable;
use Nagy\LaravelRating\Traits\Vote\Votable;
use Nagy\LaravelRating\Traits\Like\Likeable;
Also Likeabke used instead of Likeable in
include Likeabke trait to your model that will be likeabke
class Post extends Model { use Likeabke;
please update the requirements to use it in laravel 9
Still getting errors for uses of the traits after successfully install ServiceProvider files and update composer.
PHP 7.1
Laravel Framework 5.6.39
use Nagy\LaravelRating\Traits\Rate\CanRate;
use Nagy\LaravelRating\Traits\Vote\CanVote;
use Nagy\LaravelRating\Traits\Like\CanLike;
class Users extends Authenticatable
{
use CanRate;
use CanVote;
use CanLike;
...
}
use Nagy\LaravelRating\Traits\Like\Likeable;
class Articles extends Model
{
use Likeable;
...
}
Controller:
$user = Users::where('id', auth()->user()->id)->get();
$user->liked($article);
Error: Method Illuminate\Database\Eloquent\Collection::liked does not exist
Currently ratingsAvg() was taking likes & dislikes into consideration when calculating the average rating for a specific model which is wrong.
I had to change it manually and I think I have to do the same with the votes.
you need to add the where clause and also return the result of avg with two decimal places
Hello,
I am wondering if there is a way currently to "upvote/downvote" a particular resource without a model attached to the "voting".
E.g.:
Instead of: $user->upVote($item);
allow upvote($item);
If not, it seems like this could be added, I'm just not sure if the architecture allows it.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.