Skip to content

Commit

Permalink
Use data_get in groupByHierarchy to be used also with objects (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviapa authored and joskfg committed Sep 4, 2018
1 parent 9594add commit d24b850
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ private function registerGroupByHierarchy()
foreach ($this->items as $item) {
$hierarchyItemPointer = $hierarchyData;
foreach ($hierarchyKeys as $key) {
if (!isset($item[$key])) {
$value = data_get($item, $key);
if (!isset($value)) {
throw new \RuntimeException("Grouping error: '${key}' doesn't exist in collection");
}
$value = $item[$key];

if (!isset($hierarchyItemPointer[$value])) {
$hierarchyItemPointer[$value] = collect();
Expand Down

0 comments on commit d24b850

Please sign in to comment.