1414 */
1515abstract class AbstractResource
1616{
17+ protected string $ path = '' ;
18+
1719 public function __construct (
1820 private SDK $ sdk ,
19- private null |string $ path = null ,
2021 protected string $ authHeader = 'Bearer ' ,
2122 private array $ with = [],
2223 protected array $ relations = [],
@@ -151,7 +152,7 @@ public function get(): ResponseInterface
151152 */
152153 public function find (string |int $ identifier ): ResponseInterface
153154 {
154- $ this ->sdk ()->uri ()->addPath (
155+ $ this ->loadPath ()-> sdk ()->uri ()->addPath (
155156 path: "{$ this ->sdk ()->uri ()->path ()}/ {$ identifier }" ,
156157 );
157158
@@ -182,6 +183,8 @@ public function find(string|int $identifier): ResponseInterface
182183 */
183184 public function create (array $ data ): ResponseInterface
184185 {
186+ $ this ->loadPath ();
187+
185188 if (! is_null ($ this ->with )) {
186189 $ this ->sdk ()->uri ()->addPath (
187190 path: "{$ this ->sdk ()->uri ()->path ()}/ " . implode ("/ " , $ this ->with ),
@@ -205,7 +208,7 @@ public function create(array $data): ResponseInterface
205208 */
206209 public function update ($ identifier , array $ data , string $ method = 'patch ' ): ResponseInterface
207210 {
208- $ this ->sdk ()->uri ()->addPath (
211+ $ this ->loadPath ()-> sdk ()->uri ()->addPath (
209212 path: "{$ this ->sdk ()->uri ()->path ()}/ {$ identifier }" ,
210213 );
211214
@@ -232,7 +235,7 @@ public function update($identifier, array $data, string $method = 'patch'): Resp
232235 */
233236 public function delete (string |int $ identifier ): ResponseInterface
234237 {
235- $ this ->sdk ()->uri ()->addPath (
238+ $ this ->loadPath ()-> sdk ()->uri ()->addPath (
236239 path: "{$ this ->sdk ()->uri ()->path ()}/ {$ identifier }"
237240 );
238241
0 commit comments