added support ticket and added more stat widgets

This commit is contained in:
Gitea
2025-05-17 05:11:29 +05:30
parent f30d7fa096
commit 175a7203f3
19 changed files with 975 additions and 6 deletions

View File

@@ -4,6 +4,8 @@ namespace App\Filament\Widgets;
use App\Models\Log;
use App\Models\Meta;
use App\Models\PremiumEmail;
use App\Models\Ticket;
use App\Models\User;
use DB;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
@@ -15,10 +17,14 @@ class StatsOverview extends BaseWidget
{
return [
Stat::make('Total Users', $this->getUser()),
Stat::make('Customers', $this->getCustomerCount()),
Stat::make('Paid Users', $this->getUserPaid()),
Stat::make('Logs Count', $this->getLogsCount()),
Stat::make('Total Mailbox', $this->getTotalMailbox()),
Stat::make('Emails Received', $this->getTotalEmailsReceived()),
Stat::make('Emails Stored', $this->getStoreEmailsCount()),
Stat::make('Open Tickets', $this->getOpenTicketsCount()),
Stat::make('Closed Tickets', $this->getClosedTicketsCount()),
];
}
private function getUser(): int
@@ -44,4 +50,22 @@ class StatsOverview extends BaseWidget
{
return Meta::select('value')->where(['key' => 'messages_received'])->first()->value;
}
private function getCustomerCount(): int
{
return User::whereNotNull('stripe_id')->count();
}
private function getStoreEmailsCount(): int
{
return PremiumEmail::all()->count();
}
private function getOpenTicketsCount(): int
{
return Ticket::whereIn('status', ['open', 'pending'])->count();
}
private function getClosedTicketsCount(): int
{
return Ticket::whereIn('status', ['closed'])->count();
}
}