shift_id; $branch_id = $request->branch_id; $currentDate = Carbon::now(); $currentDate = $currentDate->toDateString(); //this below code line is used for getting core existing APIs url $Core_Api_root = env('CORE_API_ROOT', true); //$mytime = $mytime['date']; //$_GET['dateTime'] //return $mytime; //$request->branch_id; //http://192.168.0.4:4300/appointments/completed?branch_id=4&dateTime=2019-05-10&shift_id=1 //In this API Query Parameter We can pass "sort" for on which column we want sort, "order" for order by ASC and DESC,"branch_id" for getting perticular branch Related Data,"shift_id" for getting perticular shift data and "dateTime" for getting data on pertcilular date, $client = new Client(); $res = $client->request('GET', $Core_Api_root.'appointments/completed',[ 'query' => ['branch_id' => $branch_id, 'dateTime'=>$currentDate, 'shift_id'=> $shift_id] ]); if ($res->getStatusCode() == 200) { // 200 OK $response_data = $res->getBody()->getContents(); } return $response_data; //THis code is working for inserting data with encrytion /* $test1 = DB::table('encryption')->insert( array( 'name' => DB::raw("AES_ENCRYPT('Rahul khan 1', 'lkshs872njl8slkjfls23jslfjks')") ) ); return $test1; */ // $test = DB::table('appointments') // ->LeftJoin('patients', 'appointments.patient_id', '=', 'patients.id') // ->select('appointments.id','appointments.branch_id','patients.id as patient_id', DB::raw("AES_DECRYPT('patients.first_name', 'lkshs872njl8slkjfls23jslfjks')") )->whereDate('created_at', '=', Carbon::today()->toDateString())->paginate(10); // return $test; //$lastQuery = end($test); // dd($test->getSql()); return $test; $appointments = new patients(); $appointments = patients::paginate(10); return $appointments; //dd($appointments); // return appointments; // $test = appointments::with(array('patients'=>function($query){ // $query->select('first_name','registration_number'); // }))->paginate(10); //return $test; // return $patients; //return $appointments->with(['users','patients'])->whereDate('created_at', '=', Carbon::yesterday()->toDateString())->paginate(10); //r //This below code is used for getting in clinic patients using model but we have commented this because not have all datatable with migrating //This code will be used in future when we create first phase with lumen and migrating all the tables, Rahulm Khan //return appointments::with(['users','patients'])->whereDate('created_at', '=', Carbon::today()->toDateString())->paginate(10); try{ if($id > 0){ return Branch::find($id); }else if($request->has('query_string')){ return Branch::where('title', 'LIKE', '%' . $request->query_string . '%')->paginate(10); }else{ return Branch::where('status', '!=', '0')->orderBy('id', 'DESC')->paginate(10); } }catch(\Illuminate\Database\QueryException $ex){ $res['status'] = false; $res['message'] = $ex->getMessage(); return response($res, 500); }; } public function getMedicineQueuePatients($id='', Request $request) { $Core_Api_root = env('CORE_API_ROOT', true); //return $Core_Api_root; $shift_id = $request->shift_id; $branch_id = $request->branch_id; $currentDate = Carbon::now(); $currentDate = $currentDate->toDateString(); $client = new Client(); $res = $client->request('GET', $Core_Api_root.'appointments/branch',[ 'query' => ['branch_id' => $branch_id, 'dateTime'=>$currentDate, 'shift_id'=> $shift_id] ]); if ($res->getStatusCode() == 200) { // 200 OK $response_data = $res->getBody()->getContents(); } return $response_data; try{ if($id > 0){ return Branch::find($id); }else if($request->has('query_string')){ return Branch::where('title', 'LIKE', '%' . $request->query_string . '%')->paginate(10); }else{ return Branch::where('status', '!=', '0')->orderBy('id', 'DESC')->paginate(10); } }catch(\Illuminate\Database\QueryException $ex){ $res['status'] = false; $res['message'] = $ex->getMessage(); return response($res, 500); }; } //private function AES_DECRYPT($id){ //return $id; //return AES_DECRYPT('$id', 'lkshs872njl8slkjfls23jslfjks'); //return $this; //} } //{"id":10,"patient_id":"b825a45d-ea86-11e5-a523-e840f2e33728","is_registered":"1","doctor_id":"0b4ce8f5-e51e-11e5-9307-06de367cbccd","branch_id":1,"dateTime":"2016-06-01 10:00:00","is_rescheduled":0,"notes":"","onspot":0,"queue_number":null,"shift_id":1,"medicine_queue_number":null,"appointment_queue_number":0,"big_screen":0,"created_at":"0000-00-00 00:00:00","big_screen_doctor":"","medicine_complete":0,"checkin_time":null,"absent":0,"current_appointment_date":null,"copyid":"10","users":null}