```php
<?php

require_once '../../core/api_bootstrap.php';


require_once '../../core/employee_auth.php';
EmployeeAuth::check('view_analytics');

try {

$db = new Database();
$conn = $db->connect();

$today = $conn->query("

SELECT COUNT(*) FROM customer_leads
WHERE DATE(created_at)=CURDATE()

")->fetchColumn();

$total = $conn->query("

SELECT COUNT(*) FROM customer_leads

")->fetchColumn();

$providers = $conn->query("

SELECT COUNT(*) FROM providers
WHERE account_status='active'

")->fetchColumn();

$subscriptions = $conn->query("

SELECT COUNT(*) FROM provider_subscriptions
WHERE status='active'

")->fetchColumn();

Response::success([

"today_leads"=>$today,
"total_leads"=>$total,
"active_providers"=>$providers,
"active_subscriptions"=>$subscriptions

]);

}
catch(Exception $e){

Logger::log("system.log",$e->getMessage());

Response::error("Server error",500);

}