<?php

namespace App\Http\Controllers\api\v1;

use App\Http\Controllers\BaseController;

use App\Modules\Bookings\Onsite;

class jophielSicknessControllerRESTv1 extends BaseController
{
    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function index()
    {
            $ch = curl_init();
            $id = Auth::user()->id;
            curl_setopt($ch, CURLOPT_URL, config('jophiel.url').'/api/sickness?staff='.$id);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

            $header = array();
            $header[] = 'Content-length: 0';
            $header[] = 'Content-type: application/json';
            $header[] = 'Authorization: Bearer '. config('jophiel.token');
            curl_setopt($ch, CURLOPT_HTTPHEADER,$header);

            
            $head = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);
            // if ( $httpCode != 200) {
            //     return 'error';
            // }   
            return $head;
    }
}
