diff --git a/src/Html/Builder.php b/src/Html/Builder.php
index 83e16ed..3e3af09 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 addScriptIfCan(string $ability, string $view): static
+ {
+ if (Gate::allows($ability)) {
+ $this->addScript($view);
+ }
+
+ return $this;
+ }
+
public function addScriptIf(bool $condition, string $view): static
{
if ($condition) {