PHP code example of rezaamini-ir / laravel-tracker

1. Go to this page and download the library: Download rezaamini-ir/laravel-tracker library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rezaamini-ir / laravel-tracker example snippets


use Tracker\Traits\Trackable;

class Article extends Model{
    use Trackable;
}

class ArticleContoller extends Controller
{
    public function show(Article $article){
        $article->track();
        //..
    }
}

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 
    }
}
bash
php artisan tracker:install
bash
php artisan migrate