From 9e2a0428cc99e4084fb7da59857b5a232f0bc08a Mon Sep 17 00:00:00 2001 From: Katalam Date: Mon, 23 Jan 2023 12:29:47 +0100 Subject: [PATCH 1/2] Adding the ability to have route parameters --- composer.json | 6 +----- src/Commands/JsonStructureCommand.php | 5 +++-- src/Facades/.gitkeep | 0 src/Facades/JsonStructure.php | 16 ---------------- 4 files changed, 4 insertions(+), 23 deletions(-) create mode 100644 src/Facades/.gitkeep delete mode 100644 src/Facades/JsonStructure.php diff --git a/composer.json b/composer.json index ef157ac..81abead 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,6 @@ "autoload": { "psr-4": { "Hyperlink\\JsonStructure\\": "src", - "Hyperlink\\JsonStructure\\Database\\Factories\\": "database/factories" } }, "autoload-dev": { @@ -62,11 +61,8 @@ "providers": [ "Hyperlink\\JsonStructure\\JsonStructureServiceProvider" ], - "aliases": { - "JsonStructure": "Hyperlink\\JsonStructure\\Facades\\JsonStructure" - } } }, "minimum-stability": "dev", "prefer-stable": true -} \ No newline at end of file +} diff --git a/src/Commands/JsonStructureCommand.php b/src/Commands/JsonStructureCommand.php index 3739cc7..1870e6b 100644 --- a/src/Commands/JsonStructureCommand.php +++ b/src/Commands/JsonStructureCommand.php @@ -10,7 +10,8 @@ class JsonStructureCommand extends Command { public $signature = 'json:structure - {endpoint? : The api route name to get the json structure from}'; + {endpoint? : The api route name to get the json structure from} + {parameter?* : The parameters to pass to the endpoint}'; // {array?* : The array to get the json structure from}'; public $description = 'Converts a json structure to an array with the json keys'; @@ -21,7 +22,7 @@ public function handle(): int // if ($this->argument('endpoint')) { $this->info('Getting json structure from endpoint...'); - $response = Http::get(route($this->argument('endpoint'))); + $response = Http::get(route($this->argument('endpoint'), $this->argument('parameter'))); if ($response->failed()) { $this->error('Could not get json structure from endpoint'); diff --git a/src/Facades/.gitkeep b/src/Facades/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/Facades/JsonStructure.php b/src/Facades/JsonStructure.php deleted file mode 100644 index 9e825e0..0000000 --- a/src/Facades/JsonStructure.php +++ /dev/null @@ -1,16 +0,0 @@ - Date: Mon, 23 Jan 2023 12:31:26 +0100 Subject: [PATCH 2/2] Fix composer.json format --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 81abead..1e1877a 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ }, "autoload": { "psr-4": { - "Hyperlink\\JsonStructure\\": "src", + "Hyperlink\\JsonStructure\\": "src" } }, "autoload-dev": { @@ -60,7 +60,7 @@ "laravel": { "providers": [ "Hyperlink\\JsonStructure\\JsonStructureServiceProvider" - ], + ] } }, "minimum-stability": "dev",