2017 © Pedro Peláez
 

library laravel-popular

A Laravel package to track popularity of entries(by Models) in a website at a certain time.

image

jordanmiguel/laravel-popular

A Laravel package to track popularity of entries(by Models) in a website at a certain time.

  • Wednesday, September 27, 2017
  • by JordanMiguel
  • Repository
  • 1 Watchers
  • 12 Stars
  • 373 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 6 Versions
  • 37 % Grown

The README.md

Laravel Popular (Laravel Popularity)

Latest Version on Packagist MIT licensed, (*1)

With Laravel Popular Package you can Track your most popular Eloquent Models based on unique hits in a time range and then sort by popularity in a time frame., (*2)

Discontinued

This project is not maintained anymore. We encourage you to use another well maintained solution that can archieve everything in here: https://github.com/cyrildewit/eloquent-viewable, (*3)

Usage

Use the visitable trait on the model you intend to track ``` php use \JordanMiguel\LaravelPopular\Traits\Visitable;, (*4)

class Post extends Model { use Visitable;, (*5)

...

}, (*6)


Here are some code examples: ``` php // Adding a visit to the post. Recommended on the show() method of your controller. $post->visit(); // Retrieving the count of visitors in a timeframe $post->visitsDay(); $post->visitsWeek(); $post->visitsMonth(); $post->visitsBetween($from, $to); $post->visitsForever(); // Ordering the posts by the most visited Posts::popularLast(3)->get(); // Get popular posts on the last 3 days Posts::popularDay()->get(); // Get posts ordered by the most visited on the last 24h Posts::popularWeek()->get(); Posts::popularMonth()->get(); Posts::popularYear()->get(); Posts::popularBetween($from, $to)->get(); // Get posts ordered by the most visited in a given interval date Posts::popularAllTime()->get();

Install

Via Composer, (*7)

``` bash $ composer require jordanmiguel/laravel-popular, (*8)


If you're on Laravel <= 5.4 add `'JordanMiguel\LaravelPopular\LaravelPopularServiceProvider::class',` in your `config/app.php` to the end of the `$providers` array ``` php 'providers' => array( 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Auth\AuthServiceProvider', ... 'JordanMiguel\LaravelPopular\LaravelPopularServiceProvider::class', ),

Now, let's create our table on the database:, (*9)

bash $ php artisan migrate, (*10)

We're ready!, (*11)

Testing

There is no test setup yet, please pull request if you do it =), (*12)

Contributing

Feel free to Pull Request anytime!, (*13)

Author

License

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

The Versions

27/09 2017

dev-master

9999999-dev https://github.com/jordanmiguel/laravel-popular

A Laravel package to track popularity of entries(by Models) in a website at a certain time.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel popular jordanmiguel laravel-popular laravel popular

19/09 2017

v1.0.4

1.0.4.0 https://github.com/jordanmiguel/laravel-popular

A Laravel package to track popularity of entries(by Models) in a website at a certain time.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel popular jordanmiguel laravel-popular laravel popular

07/09 2017

v1.0.3

1.0.3.0 https://github.com/jordanmiguel/laravel-popular

A Laravel package to track popularity of entries(by Models) in a website at a certain time.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel popular jordanmiguel laravel-popular laravel popular

03/09 2017

v1.0.2

1.0.2.0 https://github.com/jordanmiguel/laravel-popular

A Laravel package to track popularity of entries(by Models) in a website at a certain time.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel popular jordanmiguel laravel-popular laravel popular

01/09 2017

v1.0.1

1.0.1.0 https://github.com/jordanmiguel/laravel-popular

A Laravel package to track popularity of entries(by Models) in a website at a certain time.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel popular jordanmiguel laravel-popular laravel popular

01/09 2017

v1.0.0

1.0.0.0 https://github.com/jordanmiguel/laravel-popular

A Laravel package to track popularity of entries(by Models) in a website at a certain time.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel popular jordanmiguel laravel-popular laravel popular