PHP code example of bensampo / laravel-count-totals

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

    

bensampo / laravel-count-totals example snippets


$totals = Subscriber::countTotals([
    ['status' => 'confirmed'],
    ['status' => 'cancelled'],
    ['name' => 'Jonathan Reinink'],
]);

$totals->confirmed // 2
$totals->cancelled // 1
$totals->jonathanReinink // 1

$totals = DB::table('subscribers')->countTotals([
    ['status' => 'confirmed'],
    ['status' => 'cancelled'],
    ['name' => 'Jonathan Reinink'],
]);