14
14
*/
15
15
abstract class AbstractResource
16
16
{
17
+ protected string $ path = '' ;
18
+
17
19
public function __construct (
18
20
private SDK $ sdk ,
19
- private null |string $ path = null ,
20
21
protected string $ authHeader = 'Bearer ' ,
21
22
private array $ with = [],
22
23
protected array $ relations = [],
@@ -151,7 +152,7 @@ public function get(): ResponseInterface
151
152
*/
152
153
public function find (string |int $ identifier ): ResponseInterface
153
154
{
154
- $ this ->sdk ()->uri ()->addPath (
155
+ $ this ->loadPath ()-> sdk ()->uri ()->addPath (
155
156
path: "{$ this ->sdk ()->uri ()->path ()}/ {$ identifier }" ,
156
157
);
157
158
@@ -182,6 +183,8 @@ public function find(string|int $identifier): ResponseInterface
182
183
*/
183
184
public function create (array $ data ): ResponseInterface
184
185
{
186
+ $ this ->loadPath ();
187
+
185
188
if (! is_null ($ this ->with )) {
186
189
$ this ->sdk ()->uri ()->addPath (
187
190
path: "{$ this ->sdk ()->uri ()->path ()}/ " . implode ("/ " , $ this ->with ),
@@ -205,7 +208,7 @@ public function create(array $data): ResponseInterface
205
208
*/
206
209
public function update ($ identifier , array $ data , string $ method = 'patch ' ): ResponseInterface
207
210
{
208
- $ this ->sdk ()->uri ()->addPath (
211
+ $ this ->loadPath ()-> sdk ()->uri ()->addPath (
209
212
path: "{$ this ->sdk ()->uri ()->path ()}/ {$ identifier }" ,
210
213
);
211
214
@@ -232,7 +235,7 @@ public function update($identifier, array $data, string $method = 'patch'): Resp
232
235
*/
233
236
public function delete (string |int $ identifier ): ResponseInterface
234
237
{
235
- $ this ->sdk ()->uri ()->addPath (
238
+ $ this ->loadPath ()-> sdk ()->uri ()->addPath (
236
239
path: "{$ this ->sdk ()->uri ()->path ()}/ {$ identifier }"
237
240
);
238
241
0 commit comments