service->regenerateClientSecret($id); return $this->updated(SerializerRegistry::getInstance()->getSerializer($resource_server->getClient())->serialize()); } catch (ValidationException $ex1) { Log::warning($ex1); return $this->error412(array( $ex1->getMessage())); } catch (EntityNotFoundException $ex2) { Log::warning($ex2); return $this->error404(array('message' => $ex2->getMessage())); } catch (Exception $ex) { Log::error($ex); return $this->error500($ex); } } public function activate($id) { try { $entity = $this->service->update($id, ['active' => true]); return $this->updated(SerializerRegistry::getInstance()->getSerializer($entity)->serialize()); } catch (ValidationException $ex1) { Log::warning($ex1); return $this->error412(array( $ex1->getMessage())); } catch (EntityNotFoundException $ex2) { Log::warning($ex2); return $this->error404(array('message' => $ex2->getMessage())); } catch (Exception $ex) { Log::error($ex); return $this->error500($ex); } } public function deactivate($id) { try { $entity = $this->service->update($id, ['active' => false]); return $this->updated(SerializerRegistry::getInstance()->getSerializer($entity)->serialize()); } catch (ValidationException $ex1) { Log::warning($ex1); return $this->error412(array( $ex1->getMessage())); } catch (EntityNotFoundException $ex2) { Log::warning($ex2); return $this->error404(array('message' => $ex2->getMessage())); } catch (Exception $ex) { Log::error($ex); return $this->error500($ex); } } /** * @return array */ protected function getUpdatePayloadValidationRules(): array { return [ 'host' => 'sometimes|required|host|max:255', 'ips' => 'required', 'friendly_name' => 'sometimes|required|text|max:512', ]; } /** * @return array */ protected function getCreatePayloadValidationRules(): array { return [ 'host' => 'required|host|max:255', 'ips' => 'required', 'friendly_name' => 'required|text|max:512', 'active' => 'required|boolean', ]; } }