Update: 2026-05-04 01:52:13
This commit is contained in:
@@ -14,6 +14,13 @@ $allowedRoles = ['admin', 'accountant', 'employee'];
|
||||
if (!in_array($decoded['role'], $allowedRoles)) {
|
||||
json_error('Unauthorized to upload invoices', 403);
|
||||
}
|
||||
// 2. Validate Request
|
||||
$data = input();
|
||||
$companyId = $data['company_id'] ?? null;
|
||||
|
||||
if (!$companyId || !isset($_FILES['invoice'])) {
|
||||
json_error('Company ID and invoice file are required', 422);
|
||||
}
|
||||
|
||||
// 3. Permission Check
|
||||
$tenantId = $decoded['tenant_id'];
|
||||
|
||||
Reference in New Issue
Block a user