diff --git a/src/Models/Item.php b/src/Models/Item.php index 23707f6..d6ef513 100644 --- a/src/Models/Item.php +++ b/src/Models/Item.php @@ -70,6 +70,9 @@ final class Item extends Model case 'updated_at': return object_get($this->getAttribute('MetaData'),'LastUpdatedTime'); + case 'pid': + return (($x=object_get($this->getAttribute('ParentRef'),'name')) ? $x.':' : '').$this->Name; + default: return parent::__get(Arr::get($keymap,$key,$key)); } diff --git a/src/Response/ListList.php b/src/Response/ListList.php index 2577ffa..82b7606 100644 --- a/src/Response/ListList.php +++ b/src/Response/ListList.php @@ -57,6 +57,19 @@ class ListList extends Base implements \Countable, \ArrayAccess, \Iterator } } + public function __call(string $name,array $args) + { + switch ($name) { + case 'first': + return $this->_data->{$name}(); + case 'pluck': + return $this->_data->map(function($item) use ($args) { return $item->{$args[0]}; }); + + default: + throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()',get_class($this),$name)); + } + } + public function current(): mixed { return $this->_data[$this->counter];