Untitled

Anonymous
plain_text
02/11/2026 8:20 AM
968 B
16
Indexable
public static function searchEmployeeByPosition($positionId)
    {
        try {
            $response = Http::withHeaders([
                'Accept' => 'application/json',
                'Authorization' => 'Bearer ' . env('WSINT_TOKEN')
            ])->get(env('API_KAI') . '/v2/hris/get-employee-by', [
                'plans' => $positionId,
            ]);

            $body = $response->json();
            if ($body['status'] == 200) {
                return ['status' => 200, 'data' => $body['data'][0]];
            }
            return ['status' => $body['status'], 'message' => $body['message']];
        } catch (Exception $e) {
            return ['status' => 500, 'message' => $e->getMessage()];
        }
    }
Editor is loading...
Leave a Comment