30 lines
877 B
PHP
30 lines
877 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Enums\ConsultationStatus;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Consultation;
|
|
use App\Models\Project;
|
|
use Inertia\Inertia;
|
|
use Inertia\Response;
|
|
|
|
class DashboardController extends Controller
|
|
{
|
|
public function __invoke(): Response
|
|
{
|
|
return Inertia::render('dashboard', [
|
|
'projects' => Project::query()
|
|
->latestFirst()
|
|
->get(['id', 'title', 'client', 'year', 'sector', 'program', 'scope']),
|
|
'newConsultations' => Consultation::query()
|
|
->where('status', ConsultationStatus::New)
|
|
->count(),
|
|
'latestConsultations' => Consultation::query()
|
|
->latest()
|
|
->limit(5)
|
|
->get(['id', 'name', 'company', 'service', 'status', 'created_at']),
|
|
]);
|
|
}
|
|
}
|