Skip to content

ashishov/laravel-eloquent-counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-eloquent-counter

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

A view and like counter extension for Eloquent models

Install

Via Composer

$ composer require ashishov/laravel-eloquent-counter

Add the service provider in app/config/app.php:

Ashishov\EloquentCounter\ServiceProvider::class,
php artisan vendor:publish

Now you can migrate:

php artisan migrate
class Object extends Eloquent {
  use Ashishov\EloquentCounter\Countable;
}

Usage

$object->view();

**Get count of Views

$object->views_count();

**Did the user viewed the object?

$object->isViewed();

**Increment the LikeCounter in a Controller (show action)

$object->like();

**Unlike

$object->unlike();

**Get count of Likes

$object->likes_count();

**Did the user liked the object?

$object->isLiked();

Credits

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages