From b26523c0b739e19c6a1172951c20885eb6f28172 Mon Sep 17 00:00:00 2001 From: tiagof Date: Fri, 15 Mar 2024 16:40:51 +0000 Subject: [PATCH] Fix styling --- src/Models/Action.php | 4 ++-- src/Models/Condition.php | 4 ++-- src/Traits/HasVolition.php | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Models/Action.php b/src/Models/Action.php index 8f8b77e..673977c 100644 --- a/src/Models/Action.php +++ b/src/Models/Action.php @@ -12,11 +12,11 @@ */ class Action extends Element { - use HasFactory; - /** @use BelongToRule */ use BelongToRule; + use HasFactory; + protected $table = 'volition_actions'; public function action(IsAction $action): static diff --git a/src/Models/Condition.php b/src/Models/Condition.php index 677c10b..1249a9b 100644 --- a/src/Models/Condition.php +++ b/src/Models/Condition.php @@ -9,11 +9,11 @@ class Condition extends Element { - use HasFactory; - /** @use BelongToRule */ use BelongToRule; + use HasFactory; + protected $table = 'volition_conditions'; public function condition(IsCondition $condition): static diff --git a/src/Traits/HasVolition.php b/src/Traits/HasVolition.php index 9f1df99..f12153a 100644 --- a/src/Traits/HasVolition.php +++ b/src/Traits/HasVolition.php @@ -42,7 +42,7 @@ public function rule(string|Rule $rule): ?Rule * * @return Collection<\Squarebit\Volition\Contracts\IsAction> */ - public function actions(string|Rule $forRule = null): Collection + public function actions(string|Rule|null $forRule = null): Collection { $actions = $forRule ? $this->rule($forRule)?->actions @@ -60,7 +60,7 @@ public function actions(string|Rule $forRule = null): Collection * @param class-string $ofClass * @return TActionClass|null */ - public function action(string $ofClass, string $forRule = null, bool $throw = false): ?IsAction + public function action(string $ofClass, ?string $forRule = null, bool $throw = false): ?IsAction { $action = $this->actions($forRule)->firstWhere(fn (IsAction $action) => $action instanceof $ofClass); @@ -76,7 +76,7 @@ public function action(string $ofClass, string $forRule = null, bool $throw = fa /** * @param class-string<\Squarebit\Volition\Contracts\IsAction> $actionClass */ - public function executeAction(string $actionClass, string $forRule = null, bool $throw = false): mixed + public function executeAction(string $actionClass, ?string $forRule = null, bool $throw = false): mixed { return $this->action($actionClass, $forRule, $throw)?->execute($this); }