https://github.com/reziamini/laravel-tracker
A package to track your model data and monitor model data
https://github.com/reziamini/laravel-tracker
laravel laravel-package laravel-tracker monitoring track tracker
Last synced: about 2 months ago
JSON representation
A package to track your model data and monitor model data
- Host: GitHub
- URL: https://github.com/reziamini/laravel-tracker
- Owner: reziamini
- Created: 2021-01-03T19:27:25.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-10-28T19:49:15.000Z (over 2 years ago)
- Last Synced: 2025-03-26T06:05:16.564Z (2 months ago)
- Topics: laravel, laravel-package, laravel-tracker, monitoring, track, tracker
- Language: PHP
- Homepage:
- Size: 11.7 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel Tracker
A package to track your model data and monitor model data## Installation
First you should install package with composer :
```bash
composer require rezaamini-ir/laravel-tracker
```Next publish dependencies :
```bash
php artisan tracker:install
```Now you can run migration to create tracker tables:
```bash
php artisan migrate
```There we go, We have installed package, Let's use it.
## Usage
To use from package you must use from tracker trait in model which you want to track
```php
use Tracker\Traits\Trackable;class Article extends Model{
use Trackable;
}
```
Now you can use `track()` method to track in your Article Single page controller```php
class ArticleContoller extends Controller
{
public function show(Article $article){
$article->track();
//..
}
}
```It will be tracked after every seen by users.
You can set `track_mode` in config in choose what kind of tracker should be used in your project.In your stats page you can use `tracks()` and `trackCount()` method to get tracked data.
For example :```php
class StatsContoller extends Controller
{
public function getStats(Article $article){
$article->trackCount(); // An integer of tracked count
$article->tracks; // A collection of tracked data
$article->trackBetween(now()->subDays(7), now()); // Tracked data between range of date since last week
}
}
```