permissions instanceof Closure) { return call_user_func($this->permissions, $user); } foreach ((array) $this->permissions as $permission) { if (! $user->hasPermission($permission)) { return false; } } return true; } /** * Set permissions required for viewing the widget on the dashboard. */ public function permissions($permissions): self { $this->permissions = $permissions; return $this; } /** * Custom scripts that are required by this widget to work * and that should be rendered on the dashboard only. */ public function scripts(): ?View { return null; } }