PHP code example of gigerit / laravel-model-stats

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

    

gigerit / laravel-model-stats example snippets

 
$result = [
    'a' => 10,
    'b' => 20
];
 
/**
 * Register the ModelStats gate.
 *
 * This gate determines who can access ModelStats in non-local environments.
 *
 * @return void
 */
protected function gate()
{
    Gate::define('viewModelStats', function ($user) {
        return in_array($user->email, [
            '[email protected]',
        ]);
    });
}
bash
php artisan model-stats:install
php artisan migrate

php artisan model-stats:publish