laravel-reactions | Laravel reactions package for implementing reactions | Networking library
kandi X-RAY | laravel-reactions Summary
kandi X-RAY | laravel-reactions Summary
Laravel reactions package for implementing reactions (eg: like, dislike, love, emotion etc) on Eloquent models.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Query scope to restrict the query to the given user .
- Toggle a reaction on a given user .
- Get a reaction to a given type .
- Create relations .
- Get the current user .
- Load migrations .
- Rel react on user .
- Migrate the schema .
- Invalid reaction by user .
- Return a reactable object .
laravel-reactions Key Features
laravel-reactions Examples and Code Snippets
$article->reactionSummary();
$article->reaction_summary;
// example
$article->reaction_summary->toArray();
// output
/*
[
"like" => 5,
"dislike" => 2,
"clap" => 4,
"hooray" => 1
]
*/
use Illuminate\Database\Eloquent\Model;
use Qirolab\Laravel\Reactions\Traits\Reactable;
use Qirolab\Laravel\Reactions\Contracts\ReactableInterface;
class Article extends Model implements ReactableInterface
{
use Reactable;
}
use Qirolab\Laravel\Reactions\Traits\Reacts;
use Qirolab\Laravel\Reactions\Contracts\ReactsInterface;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements ReactsInterface
{
use Reacts;
}
Community Discussions
Trending Discussions on laravel-reactions
QUESTION
I'm using this package as a voting system, I use Laravel 7, I avoid pasting the various codes because you can find all the documentation here: https://github.com/qirolab/laravel-reactions
I was testing the whole thing, but can't show a certain reaction count? I mean, $article->reactionSummary() shows an array of all reactions, but I'd like to show the "Like" reaction count.
...ANSWER
Answered 2020-Oct-23 at 08:52If you want to retrieve a value from your reactionSummary
you can do:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install laravel-reactions
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page