Skip to content

Commit 9975456

Browse files
committed
feat: Add addScriptIf method
1 parent 869b050 commit 9975456

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Html/Builder.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,13 @@ public function addScript(string $view): static
263263

264264
return $this;
265265
}
266+
267+
public function addScriptIf(bool $condition, string $view): static
268+
{
269+
if ($condition) {
270+
$this->addScript($view);
271+
}
272+
273+
return $this;
274+
}
266275
}

0 commit comments

Comments
 (0)