Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Html/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,15 @@ public function addScript(string $view): static
return $this;
}

public function addScriptIfCan(string $permission, string $view): static
{
if (Gate::allows($permission)) {
$this->addScript($view);
}

return $this;
}

public function addScriptIf(bool $condition, string $view): static
{
if ($condition) {
Expand Down
Loading