Skip to content

Commit 51a97e9

Browse files
authored
Merge branch 'master' into fix-use-gate-denies
2 parents 44d8e33 + 4b7c470 commit 51a97e9

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
@@ -265,6 +265,15 @@ public function addScript(string $view): static
265265
return $this;
266266
}
267267

268+
public function addScriptIf(bool $condition, string $view): static
269+
{
270+
if ($condition) {
271+
$this->addScript($view);
272+
}
273+
274+
return $this;
275+
}
276+
268277
public function addScriptIfCannot(string $ability, string $view): static
269278
{
270279
if (Gate::denies($ability)) {

0 commit comments

Comments
 (0)