Commit f144aff7 authored by Kristian Feldsam's avatar Kristian Feldsam
Browse files

Resource - Added method toArray


Signed-off-by: Kristian Feldsam's avatarKristián Feldsam <feldsam@gmail.com>
parent 773a23ad
......@@ -120,4 +120,16 @@ class Resource
{
return new ArrayIterator($this->all());
}
/**
* @param mixed $key
* @return array
*/
public function toArray($key = null): array {
$data = $this->dot->get($key);
if (is_array($data)) return $data;
return [$data];
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment