From 7d446d4fe308576427c1cb340b662da6d5339e0c Mon Sep 17 00:00:00 2001 From: Asva Date: Tue, 18 Apr 2017 11:39:13 +0300 Subject: [PATCH] Request data optional --- config/api-tester.php | 15 ++++++++++++++- src/Entities/RouteInfo.php | 8 +++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/config/api-tester.php b/config/api-tester.php index c0ea5e7..ac9dbb4 100644 --- a/config/api-tester.php +++ b/config/api-tester.php @@ -55,11 +55,24 @@ | !WARNING! | This sometimes causes fatal errors, rendering api tester unusable. | Set to false if that's your case. - | */ 'route_meta' => true, + + /* + |-------------------------------------------------------------------------- + | Request analysis + |-------------------------------------------------------------------------- + | Display request rules.. + | + | !WARNING! + | This sometimes causes fatal errors, rendering api tester unusable. + | Set to false if that's your case. + */ + + 'request_rules' => true, + /* |-------------------------------------------------------------------------- | Filter routes diff --git a/src/Entities/RouteInfo.php b/src/Entities/RouteInfo.php index 8ff8c8c..d5f049d 100644 --- a/src/Entities/RouteInfo.php +++ b/src/Entities/RouteInfo.php @@ -41,11 +41,17 @@ class RouteInfo implements Arrayable, JsonSerializable */ private $route; + /** + * @var bool + */ + private $analyzeRequests; + public function __construct($route, $options = []) { $this->route = $route; $this->options = $options; $this->addMeta = config('api-tester.route_meta'); + $this->analyzeRequests = config('api-tester.analyze_requests'); } /** @@ -141,7 +147,7 @@ protected function extractFormRequest() } // Если это форм-реквест. - if (is_subclass_of($class->name, FormRequest::class)) { + if (is_subclass_of($class->name, FormRequest::class && $this->analyzeRequests)) { // Для вызова нестатического метода на объекте, нам необходим инстанс объекта. // Мы используем build вместо make, чтобы избежать автоматического запуска валидации.