PHP code example of seyamms / laravel-visit

1. Go to this page and download the library: Download seyamms/laravel-visit 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/ */

    

seyamms / laravel-visit example snippets


/**
 * available factors are:
 * ['ip_address', 'platform', 'device', 'browser', 'language']
 * default: ['ip_address', 'platform']
 */
'factors' => [
    'ip_address',
    'platform',
    // 'device',
    // 'browser',
    // 'language',
],


// this accepts a valid carbon interval. 
// 1 day, 2 days, 1 week, 2 months ...etc
// default: 1 day 
'span' => '1 day',



namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use SeyamMs\LaravelVisit\Traits\Visitable;

class Page extends Model
{
    use Visitable;

$page->vzt()->increment();

$page->vzt()->count()
bash
php artisan vendor:publish --tag="laravel-visit-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="laravel-visit-config"