mongoDbTest(); $data['envID'] = getenv('ENV_ID'); $data['home_background'] = getenv('HOME_PAGE_BACKGROUND'); return view('welcome_message',$data); } public function test() { //const WRENCHBOARD_TEST_PATH = 9999099; //echo "hello world, from home controller"; $raw_json = file_get_contents('php://input'); $in = json_decode($raw_json, true); $out =[]; $in["action"] = WRENCHBOARD_TEST_PATH; $in["dummy"] ="This is a dummy message for test"; $ret = $this->wrenchboard->wrenchboard_api($in, $out); $out['internal_return'] = $ret; return $this->respond($this->summaryReturnData($in, $out), 200); } public function mongoDbTest(){ $client = new \MongoDB("mongodb://chiefsoft:may12002@10.0.0.32:27017/","mongoClient"); try { // Send a ping to confirm a successful connection $client->selectDatabase('admin')->command(['ping' => 1]); //echo "Pinged your deployment. You successfully connected to MongoDB!\n"; log_message('critical', "Pinged your deployment. You successfully connected to MongoDB!"); } catch (Exception $e) { log_message('critical', "Pinged your deployment. You failed connected to MongoDB! :: ".$e->getMessage()); // printf($e->getMessage()); } //$client->createDBRef() // $currDb = $client->createCollection("traffic"); //$currDb->insert() } }