base commit

This commit is contained in:
Mekan1206
2026-07-30 17:24:40 +05:00
commit a794dacd39
345 changed files with 29597 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace App\Filament\Widgets;
use App\Models\Employee;
use Filament\Widgets\ChartWidget;
class MonthlyHiringChart extends ChartWidget
{
protected ?string $heading = 'Monthly Hiring (Last 12 Months)';
protected int | string | array $columnSpan = 1;
protected function getType(): string
{
return 'bar';
}
protected function getData(): array
{
$labels = [];
$data = [];
for ($i = 11; $i >= 0; $i--) {
$month = now()->subMonths($i);
$labels[] = $month->format('M Y');
$data[] = Employee::query()
->whereNotNull('hire_date')
->whereYear('hire_date', $month->year)
->whereMonth('hire_date', $month->month)
->count();
}
return [
'datasets' => [
[
'label' => 'New Hires',
'data' => $data,
'backgroundColor' => '#3b82f6',
],
],
'labels' => $labels,
];
}
}