Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

A Laravel 5 package providing counting functionality on models, with "views" and "likes" support out of the box

License

Notifications You must be signed in to change notification settings

Team-Tea-Time/laravel-counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note: this package is under active development. While it should be completely functional, caution is advised and you might wish to wait until the first release is pushed out. Until then, things are likely to change and possibly break as features are added or altered.

If you encounter any issues or have a suggestion, please create an issue.

Installation

Step 1: Install the package

Add the package to your composer.json and run composer update:

"teamteatime/laravel-counter": "dev-master"

Add the service provider to your config/app.php:

'TeamTeaTime\Counter\CounterServiceProvider',

If your app defines a catch-all route, make sure you load this service provider before your app service providers.

Step 2: Publish the package files

Run the vendor:publish command to publish Filer's migrations:

php artisan vendor:publish

Step 3: Update your database

Run your migrations:

php artisan migrate

Step 4: Update your models

Add counter support to your models by using the HasCounters trait:

class ... extends Eloquent {
    use \TeamTeaTime\Counter\HasCounters;
}

Configuration

Filer requires no configuration out of the box in most cases, but the following options are available to you in config/counter.php:

Option Type Description Default
user Array The name of your app's User model, and a closure to return the user ID. These are used to associate counter activity with users. auth()->user()->id or 0

Usage

About

A Laravel 5 package providing counting functionality on models, with "views" and "likes" support out of the box

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages