diff --git a/.idea/hrm-mcserver.iml b/.idea/hrm-mcserver.iml index 145fd77..0fd52b5 100755 --- a/.idea/hrm-mcserver.iml +++ b/.idea/hrm-mcserver.iml @@ -146,6 +146,7 @@ + diff --git a/.idea/php.xml b/.idea/php.xml index b8be42a..f41ef1f 100755 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -153,6 +153,7 @@ + diff --git a/app/Facades/JSON.php b/app/Facades/JSON.php new file mode 100644 index 0000000..ec06d71 --- /dev/null +++ b/app/Facades/JSON.php @@ -0,0 +1,17 @@ +type = $type; + return $this; + } + + /** + * @return mixed + */ + public function getType() + { + return $this->type; + } + + /** + * @return mixed + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param mixed $status + * @return JSON + */ + public function setStatus($status) + { + $this->status = $status; + return $this; + } + + /** + * @return mixed + */ + public function getMessage() + { + return $this->message; + } + + /** + * @param mixed $message + * @return JSON + */ + public function setMessage($message) + { + $this->message = $message; + return $this; + } + + /** + * @return mixed + */ + public function getCode() + { + return $this->code; + } + + /** + * @param mixed $code + * @return JSON + */ + public function setCode($code) + { + $this->code = $code; + return $this; + } + + /** + * @return mixed + */ + public function getData() + { + return $this->data; + } + + /** + * @param mixed $data + * @return JSON + */ + public function setData($data) + { + $this->data = $data; + return $this; + } + + public function build($headers = []) + { + $response = [ + 'status' => $this->getStatus(), + 'message' => $this->getMessage(), + 'type' => $this->getType(), + 'response' => $this->getData() + ]; + + return response($response, $this->getCode(), $headers); + } + +} diff --git a/app/Providers/JSONProvider.php b/app/Providers/JSONProvider.php new file mode 100644 index 0000000..6403201 --- /dev/null +++ b/app/Providers/JSONProvider.php @@ -0,0 +1,31 @@ + GrahamCampbell\Markdown\Facades\Markdown::class, 'ContextAwareValidator' => App\Facades\ContextAwareValidation::class, 'Settings' => App\Facades\Options::class, + 'JSON' => App\Facades\JSON::class ],