From 99754563724814a169954248dd8e784c1bb071f4 Mon Sep 17 00:00:00 2001 From: Harvey Christian Pacleb Date: Wed, 1 Oct 2025 01:29:07 +0800 Subject: [PATCH] feat: Add addScriptIf method --- src/Html/Builder.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Html/Builder.php b/src/Html/Builder.php index 9172874..8440f14 100644 --- a/src/Html/Builder.php +++ b/src/Html/Builder.php @@ -263,4 +263,13 @@ public function addScript(string $view): static return $this; } + + public function addScriptIf(bool $condition, string $view): static + { + if ($condition) { + $this->addScript($view); + } + + return $this; + } }