Skip to content

Commit b17233e

Browse files
committed
Updates for parameters and new namespace
1 parent 3ef0c15 commit b17233e

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/AstritZeqiri/LaravelWpApi/Facades/WpApi.php renamed to src/jwatkin423/LaravelWpApi/Facades/WpApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace AstritZeqiri\LaravelWpApi\Facades;
3+
namespace Jwatkin423\LaravelWpApi\Facades;
44

55
use Illuminate\Support\Facades\Facade;
66
use AstritZeqiri\LaravelWpApi\WpApi as WordpressApi;

src/AstritZeqiri/LaravelWpApi/LaravelWpApiServiceProvider.php renamed to src/jwatkin423/LaravelWpApi/LaravelWpApiServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace AstritZeqiri\LaravelWpApi;
3+
namespace jwatkin423\LaravelWpApi;
44

55
use Illuminate\Support\ServiceProvider;
66

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace AstritZeqiri\LaravelWpApi;
3+
namespace jwatkin423\LaravelWpApi;
44

55
use GuzzleHttp\Client;
66
use Illuminate\Support\Traits\Macroable;
@@ -46,23 +46,24 @@ public function __construct($endpoint, Client $client, $auth = null)
4646
* Get all posts
4747
*
4848
* @param int $page
49+
* @param array $params
4950
* @return array
5051
*/
51-
public function posts($page = null)
52+
public function posts($page = null, $params = [])
5253
{
53-
return $this->get('posts', ['page' => $page]);
54+
return $this->get('posts', ['page' => $page], $params);
5455
}
5556

5657
/**
5758
* Get all pages
5859
*
59-
* @param int $page
60+
* @param int $page
61+
* @param array $params
6062
* @return array
6163
*/
62-
public function pages($page = null)
64+
public function pages($page = null, array $params = [])
6365
{
64-
return $this->get('posts', ['type' => 'page', 'page' => $page]);
65-
}
66+
return $this->get('posts', ['type' => 'page', 'page' => $page], $params); }
6667

6768
/**
6869
* Get post by id
@@ -183,9 +184,10 @@ public function archive($year, $month, $page = null)
183184
*
184185
* @param string $method
185186
* @param array $query
187+
* @param array $params
186188
* @return array
187189
*/
188-
public function get($method, array $query = array())
190+
public function get($method, array $query = array(), array $params = [])
189191
{
190192

191193
try {
@@ -196,7 +198,7 @@ public function get($method, array $query = array())
196198
$query['auth'] = $this->auth;
197199
}
198200

199-
$response = $this->client->get($this->endpoint . $method, $query);
201+
$response = $this->client->get($this->endpoint . $method, $query, $params);
200202

201203
$return = [
202204
'results' => json_decode((string) $response->getBody(), true),

0 commit comments

Comments
 (0)