From ee3a9a94b1f46da88576f4e819f2dba538dcef9c Mon Sep 17 00:00:00 2001 From: rootis69 Date: Sun, 31 May 2020 23:21:05 +0300 Subject: [PATCH 1/2] chore: change categories endpoint --- .idea/.gitignore | 2 ++ .idea/laravel-wp-api.iml | 12 ++++++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/php.xml | 4 ++++ .idea/vcs.xml | 6 ++++++ src/Threesquared/LaravelWpApi/WpApi.php | 2 +- 7 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/laravel-wp-api.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/php.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e7e9d11 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml diff --git a/.idea/laravel-wp-api.iml b/.idea/laravel-wp-api.iml new file mode 100644 index 0000000..67c1c91 --- /dev/null +++ b/.idea/laravel-wp-api.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f94f9fd --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..07f31c0 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Threesquared/LaravelWpApi/WpApi.php b/src/Threesquared/LaravelWpApi/WpApi.php index 74971dc..286a7b5 100755 --- a/src/Threesquared/LaravelWpApi/WpApi.php +++ b/src/Threesquared/LaravelWpApi/WpApi.php @@ -100,7 +100,7 @@ public function page($slug) */ public function categories() { - return $this->get('taxonomies/category/terms'); + return $this->get('categories'); } /** From 7ef3e141566c8b68e6845387f574bc70834fa11a Mon Sep 17 00:00:00 2001 From: rootis69 Date: Sun, 15 Mar 2020 16:27:57 +0300 Subject: [PATCH 2/2] update: to laravel 6 --- .gitignore | 1 + .idea/.gitignore | 4 ++++ composer.json | 8 ++++---- .../LaravelWpApi/LaravelWpApiServiceProvider.php | 13 +++++-------- src/Threesquared/LaravelWpApi/WpApi.php | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 5826402..225319b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ composer.phar composer.lock .DS_Store +.idea/ \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore index e7e9d11..450e5b3 100644 --- a/.idea/.gitignore +++ b/.idea/.gitignore @@ -1,2 +1,6 @@ # Default ignored files +<<<<<<< Updated upstream /workspace.xml +======= +/workspace.xml +>>>>>>> Stashed changes diff --git a/composer.json b/composer.json index 0bb77a8..53bdfa1 100755 --- a/composer.json +++ b/composer.json @@ -10,15 +10,15 @@ } ], "require": { - "php": ">=5.5.0", - "illuminate/support": "~5.2", + "php": "^7.2", + "illuminate/support": "^6|^7", "guzzlehttp/guzzle": "~6.0" }, "require-dev": { - "phpunit/phpunit": "4.8.*" + "phpunit/phpunit": "^8.0" }, "autoload": { - "psr-0": { + "psr-4": { "Threesquared\\LaravelWpApi\\": "src/" } }, diff --git a/src/Threesquared/LaravelWpApi/LaravelWpApiServiceProvider.php b/src/Threesquared/LaravelWpApi/LaravelWpApiServiceProvider.php index edafa52..84f29b1 100755 --- a/src/Threesquared/LaravelWpApi/LaravelWpApiServiceProvider.php +++ b/src/Threesquared/LaravelWpApi/LaravelWpApiServiceProvider.php @@ -31,14 +31,11 @@ public function boot() */ public function register() { - $this->app->singleton(WpApi::class, function ($app) { - - $endpoint = $this->app['config']->get('wp-api.endpoint'); - $auth = $this->app['config']->get('wp-api.auth'); - $client = $this->app->make('GuzzleHttp\Client'); - - return new WpApi($endpoint, $client, $auth); - + $this->app->bind(WpApi::class, function ($app) { + return new WpApi( + $this->app['config']->get('wp-api.endpoint'), + $this->app['config']->get('wp-api.auth') + ); }); } diff --git a/src/Threesquared/LaravelWpApi/WpApi.php b/src/Threesquared/LaravelWpApi/WpApi.php index 286a7b5..99a0f51 100755 --- a/src/Threesquared/LaravelWpApi/WpApi.php +++ b/src/Threesquared/LaravelWpApi/WpApi.php @@ -31,11 +31,11 @@ class WpApi * @param Client $client * @param string $auth */ - public function __construct($endpoint, Client $client, $auth = null) + public function __construct($endpoint, $auth = null) { $this->endpoint = $endpoint; - $this->client = $client; $this->auth = $auth; + $this->client = new Client(); } /**