PHP code example of bigsnowfr / larastats

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

    

bigsnowfr / larastats example snippets




use Bigsnowfr\Larastats\LarastatsFacade; 

public function index(Request $request)
    {
        $datas = [
          'userCount'      => [User::class, 'count'],
          'votesCount'     => [Vote::class, 'count'],
          'userStatsDatas' => [User::class, 'graph']
        ];


        foreach ($datas as $key => $data) {
            $$key = LarastatsFacade::getStatByDate($data[0], $request->input('start'), $request->input('end'),
              $data[1]);
        }

        return view('admin.pages.dashboard',
          compact(['userCount', 'votesCount', 'userStatsDatas']));
    }