PHP code example of spatie / filament-simple-stats
1. Go to this page and download the library: Download spatie/filament-simple-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/ */
spatie / filament-simple-stats example snippets
protected function getStats(): array
{
return [
SimpleStat::make(User::class)->last30Days()->dailyCount(),
SimpleStat::make(Purchase::class)->last30Days()->dailySum('earnings'),
];
}
protected function getStats(): array
{
return [
SimpleStat::make(Purchase::class)->where('user_id', auth()->id())->last30Days()->dailySum('earnings'),
];
}