PHP code example of abordage / nova-total-card

1. Go to this page and download the library: Download abordage/nova-total-card 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/ */

    

abordage / nova-total-card example snippets


namespace App\Nova\Dashboards;

use Abordage\TotalCard\TotalCard;
use Laravel\Nova\Dashboard;

class Main extends Dashboard
{
    public function cards(): array
    {
        $cards = [
            /* simple */
            new TotalCard(\App\Models\User::class),
            
            /* with custom title */
            new TotalCard(\App\Models\User::class, 'All users'),
            
            /* with cache expiry time */
            new TotalCard(\App\Models\User::class, 'All users',  now()->addHour()),
            
            /* with condition */
            new TotalCard(\App\Models\User::where('is_active', 1), 'Active users'),
        ];
    }
}

public function cards(): array
{
    $cards = [
        (new TotalCard(\App\Models\User::class))->height('dynamic'),
        (new TotalCard(\App\Models\User::class))->height('dynamic')->width('2/3'),
    ];
}