diff --git a/src/Html/Button.php b/src/Html/Button.php index 7a0c2fe..d65ad72 100755 --- a/src/Html/Button.php +++ b/src/Html/Button.php @@ -429,4 +429,32 @@ public function align(string $align = 'button-left'): static return $this; } + + /** + * Handle dynamic calls to the fluent instance or macroable methods. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + // Check if the method is a macro (Macroable functionality). + if (static::hasMacro($method)) { + $macro = static::$macros[$method]; + + if ($macro instanceof Closure) { + $macro = $macro->bindTo($this, static::class); + } + + return $macro(...$parameters); + } + + // Fallback to Fluent behavior if it's not a macro. + $this->attributes[$method] = count($parameters) > 0 ? reset($parameters) : true; + + return $this; + } }