public function run() { foreach ($this->data() as $data) { $db = new ModelAuth(); foreach ($data as $key => $value) { $db->{$key} = $value; } $db->save(); } }
public function bukaPintu() { try { $dbAuth = new ModelAuth(); $id_auth = $dbAuth->getIdAuthByToken($this->app->request()->headers->get('API-Token')); $this->sendTrigger($id_auth, 1); sleep(5); $this->sendTrigger($id_auth, 0); } catch (\Exception $ex) { $this->writeToJSON(['errmsg' => 'service unavailable'], 503); } }