public function create(Resource $resource) { $response = $this->getClient()->post('resources', ['headers' => ['Content-Type' => 'application/json'], 'body' => json_encode(['project' => $resource->getProjectSlug(), 'pathname' => $resource->getPathname()])])->json(); $resource->setId($response['id']); }