From 892348dc31a9be5ebc46a94662052806a309a8e3 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Wed, 18 Jan 2023 17:36:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=20=E5=93=88=E5=B8=8C?= =?UTF-8?q?=E7=A2=B0=E6=92=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Requests/BaseRequest.php | 29 +++++++++++++++++++++++++++++ public/index.php | 3 ++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 app/Http/Requests/BaseRequest.php diff --git a/app/Http/Requests/BaseRequest.php b/app/Http/Requests/BaseRequest.php new file mode 100644 index 0000000..99e4b8d --- /dev/null +++ b/app/Http/Requests/BaseRequest.php @@ -0,0 +1,29 @@ +json)) { + $content = $this->getContent(); + + $parameters = Str::length($content) > static::JSON_MAX_LENGTH ? [] : (array) json_decode($content, true); + + $this->json = new ParameterBag($parameters); + } + + if (is_null($key)) { + return $this->json; + } + + return data_get($this->json->all(), $key, $default); + } +} diff --git a/public/index.php b/public/index.php index f3c2ebc..b9ac30b 100644 --- a/public/index.php +++ b/public/index.php @@ -1,7 +1,8 @@