diff --git a/src/Html/Builder.php b/src/Html/Builder.php index 4953d53..17904fa 100644 --- a/src/Html/Builder.php +++ b/src/Html/Builder.php @@ -265,6 +265,15 @@ public function addScript(string $view): static return $this; } + public function addScriptIf(bool $condition, string $view): static + { + if ($condition) { + $this->addScript($view); + } + + return $this; + } + public function addScriptIfCannot(string $ability, string $view): static { if (! (Gate::allows($ability))) {