<?php

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


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

$data = Request::get();

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

$query = "

SELECT
p.id,
p.name,
p.phone,
p.email,
p.account_status,
p.kyc_status,
pp.business_name,
pp.city_id,
pp.pincode

FROM providers p

LEFT JOIN provider_profiles pp
ON p.id=pp.provider_id

ORDER BY p.created_at DESC

";

$stmt = $conn->query($query);

Response::success($stmt->fetchAll());