PHP code example of infinityxtech / laravel-page-statistics

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

    

infinityxtech / laravel-page-statistics example snippets


return [
    'geoip_db_path' => null
];

use Illuminate\Database\Eloquent\Model;
use CyrildeWit\EloquentViewable\InteractsWithViews;
use CyrildeWit\EloquentViewable\Contracts\Viewable;

class Post extends Model implements Viewable
{
    use InteractsWithViews;

    // ...
}

// Route model binding example

Route::get('/post/{slug}', function (Post $post) {

    $pageStatistics = new ZPMPackages\PageStatistics();

    $view = $pageStatistics->record($post);

});



    $pageStatistics = new ZPMPackages\PageStatistics();

    $details = $pageStatistics->getDetails();

    // do whatever with $details

    $view = $pageStatistics->record($post, $details);

bash
php artisan vendor:publish --tag="page-statistics-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="page-statistics-config"