public function status(array $array, $status = 200) { $array['status'] = $status; Api::render($array); }
private function authorize($publicKey, $privateKey) { $exists = Raw::ApiUser()->where(['public_key', '=', (string) $publicKey])->where(['private_key', '=', (string) $privateKey])->first(true); if ($exists) { $token = Utils::token(); $row = Raw::ApiAuth()->firstOrCreate(['user_id' => (int) $exists->id]); $row->setToken($token)->setExpiration(time() + 3600)->save(); Api::render(['status' => 200, 'execution_time' => Timer::get(), 'token' => $token]); } Api::forbidden(); }