Download the PHP package balajidharma/laravel-viewable without Composer
On this page you can find all versions of the php package balajidharma/laravel-viewable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download balajidharma/laravel-viewable
More information about balajidharma/laravel-viewable
Files in balajidharma/laravel-viewable
Package laravel-viewable
Short Description Track Page views for your Laravel projects
License MIT
Informations about the package laravel-viewable
Laravel Viewable
Track Page views for your Laravel projects.
Credits
This package builds upon the work done in cyrildewit/eloquent-viewable and has been modified to suit specific needs. We are grateful to the original author and contributors for their work.
Features
- Track page views for Laravel Eloquent models
- Configure unique views by IP, session, and authenticated users
- Bot detection and filtering
- Support for DNT (Do Not Track) header
- Configurable view counting and storage
Table of Contents
- Installation
- Configuration
- Demo
Installation
-
Install the package via composer
-
Publish the migration with
-
Run the migration
-
To Publish the config/viewable.php config file with
-
Preparing your model To associate views with a model, the model must implement the HasViewable trait:
- Recording views To make a view record, you can call the record method.
Laravel Viewable Configuration
This document describes all configuration options available in the viewable.php
config file.
Configuration Options
Models
Defines the model class used for tracking views. You can override this with your own model class if needed.
Specifies the database table name used for storing views. Default is 'views'.
Bot Detection
true
: Ignores views from bots and crawlersfalse
: Records views from all visitors including bots- Default:
true
Do Not Track (DNT) Header
true
: Respects the Do Not Track (DNT) header from browsersfalse
: Records views regardless of DNT header- Default:
false
Unique View Settings
Controls how unique views are tracked:
unique_ip
: Records only one view per IP addressunique_session
: Records only one view per sessionunique_viewer
: Records only one view per authenticated user- Default: All set to
true
Model View Counter
increment_model_view_count
: Enable/disable automatic view count increment on the modelincrement_model_column_name
: Specifies the column name for storing view count- Default: Counter disabled, column name set to 'view_count'
IP Address Filtering
- Array of IP addresses to ignore when recording views
- Views from these IPs will not be recorded
- Default: Empty array (no IPs ignored)
Control configuration on model
You able to control all the configurtion on model, by adding below properties
Demo
The "Basic Laravel Admin Penel" starter kit come with Laravel Viewable