Based on marcanuy/popularity
This is where your description should go. Take a look at contributing.md to see a to do list.
Via Composer
$ composer require sweeeeep/l5popularity
Your model should use the Popularable traits, which has method hit()
that you need use
<?php
use Sweeeeep\Popularity\Popularable;
class Post extends Model
{
use Popularable;
}
It makes use of Eloquent's polymorphic relations , so each tracked model has its own stats.
For each model instance that has already been saved into the db (or already has an id), call hit() method to increase count for each time frame, e.g. in routes.php each time a post or an article is viewed, or an Eloquent event is fired.
$post = Post::find(1);
$post->hit();
Please see the changelog for more information on what has changed recently.
Please see contributing.md for details and a todolist.
license. Please see the license file for more information.