Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Gravitano committed Jul 8, 2015
2 parents 5705abf + 85c9051 commit 7a4efd6
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/Pingpong/Widget/Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,21 @@ public function group($name, array $widgets)
$this->registerBlade($name);
}

/**
* Group some widgets, merging if previously set.
*
* @param string $name
* @param array $newWidgets
*/
public function mergeGroup($name, array $newWidgets)
{
$widgets = $this->hasGroup($name) ? $this->groups[$name] : [];

$this->groups[$name] = array_merge($widgets, $newWidgets);

$this->registerBlade($name);
}

/**
* Determine whether a group of widgets there or not.
*
Expand Down Expand Up @@ -259,6 +274,36 @@ public function callGroup($name, $parameters = array())
return $result;
}

/**
* Get a group of widgets.
*
* @param string $name
* @return array|null
*/
public function getGroup($name)
{
if (!$this->hasGroup($name)) {
return;
}

return $this->groups[$name];
}

/**
* Get a collection of a group of widgets.
*
* @param string $name
* @return \Illuminate\Support\Collection|null
*/
public function collectGroup($name)
{
if (!$this->hasGroup($name)) {
return;
}

return collect($this->groups[$name]);
}

/**
* Reorder widgets.
*
Expand Down

0 comments on commit 7a4efd6

Please sign in to comment.