This commit is contained in:
James Cole
2020-07-11 15:13:15 +02:00
parent 86600d4fcf
commit 54d92f5b39
20 changed files with 737 additions and 205 deletions

View File

@@ -358,4 +358,16 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
return $this->user->ruleGroups()->where('title', $title)->first();
}
/**
* @inheritDoc
*/
public function destroyAll(): void
{
$groups = $this->get();
/** @var RuleGroup $group */
foreach ($groups as $group) {
$group->rules()->delete();
$group->delete();
}
}
}

View File

@@ -31,13 +31,18 @@ use Illuminate\Support\Collection;
*/
interface RuleGroupRepositoryInterface
{
/**
* Delete everything.
*/
public function destroyAll(): void;
/**
* @return int
*/
public function count(): int;
/**
* @param RuleGroup $ruleGroup
* @param RuleGroup $ruleGroup
* @param RuleGroup|null $moveTo
*
* @return bool