LaravelPackages.net
Acme Inc.
Toggle sidebar
luqta/viewcount

The package enables you to calculate the view count of a resource

71
0
v2.0
About luqta/viewcount

luqta/viewcount is a Laravel package for the package enables you to calculate the view count of a resource. It currently has 0 GitHub stars and 71 downloads on Packagist (latest version v2.0). Install it with composer require luqta/viewcount. Discover more Laravel packages by luqta or browse all Laravel packages to compare alternatives.

Last updated

ViewCount

The package enables you to calculate the view count of a resource (MongoDB Collection).

Installation

  1. Via Composer
$ composer require luqta/viewcount
  1. Validate vistor_ip
'user_id' => 'string',
'countable' => 'required|boolean',
'vistor_ip' => 'required_if:countable,1|string',
'user_agent' => 'required_if:countable,1|string',
'browser_language' => 'required_if:countable,1|string',
'screen.width' => 'required_if:countable,1|numeric',
'screen.height' => 'required_if:countable,1|numeric',
'inner.width' => 'required_if:countable,1|numeric',
'inner.height' => 'required_if:countable,1|numeric',
  1. Add view_count field to your resource collection.
protected $fillable = [
    ...
    'view_count',
    ...
];
  1. Dispatch Luqta\ViewCount\ViewCountJob job in your resource controller.
dispatch(new ViewCountJob($model, $request->validated()));
  1. Use Luqta\ViewCount\Traits\Countable trait in your resource model.

Star History Chart