1. Go to this page and download the library: Download laravel-ready/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/ */
laravel-ready / statistics example snippets
use LaravelReady\Statistics\Traits\Statisticable;
class Post extends Model
{
use Statisticable;
}
use LaravelReady\Statistics\Supports\Statistic;
Statistic::touch($model); // process data then save it
Statistic::hit($model); // just saves raw data without processing (then you can process it later with jobs)
$stats = $model->load('statistics');
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('statistics:process')->everyMinute();
}
...