Finish up rule groups API

This commit is contained in:
James Cole
2018-12-07 15:36:04 +01:00
parent b782316cc0
commit 9a2e5c36a1
11 changed files with 359 additions and 366 deletions

View File

@@ -118,6 +118,18 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
return $user->ruleGroups()->where('rule_groups.active', 1)->orderBy('order', 'ASC')->get(['rule_groups.*']);
}
/**
* @param RuleGroup $group
*
* @return Collection
*/
public function getActiveRules(RuleGroup $group): Collection
{
return $group->rules()
->where('rules.active', 1)
->get(['rules.*']);
}
/**
* @param RuleGroup $group
*
@@ -184,6 +196,17 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
)->get();
}
/**
* @param RuleGroup $group
*
* @return Collection
*/
public function getRules(RuleGroup $group): Collection
{
return $group->rules()
->get(['rules.*']);
}
/**
* @param RuleGroup $ruleGroup
*

View File

@@ -65,6 +65,20 @@ interface RuleGroupRepositoryInterface
*/
public function getActiveGroups(User $user): Collection;
/**
* @param RuleGroup $group
*
* @return Collection
*/
public function getActiveRules(RuleGroup $group): Collection;
/**
* @param RuleGroup $group
*
* @return Collection
*/
public function getRules(RuleGroup $group): Collection;
/**
* @param RuleGroup $group
*