File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -429,4 +429,32 @@ public function align(string $align = 'button-left'): static
429429
430430 return $ this ;
431431 }
432+
433+ /**
434+ * Handle dynamic calls to the fluent instance or macroable methods.
435+ *
436+ * @param string $method
437+ * @param array $parameters
438+ * @return mixed
439+ *
440+ * @throws \BadMethodCallException
441+ */
442+ public function __call ($ method , $ parameters )
443+ {
444+ // Check if the method is a macro (Macroable functionality).
445+ if (static ::hasMacro ($ method )) {
446+ $ macro = static ::$ macros [$ method ];
447+
448+ if ($ macro instanceof Closure) {
449+ $ macro = $ macro ->bindTo ($ this , static ::class);
450+ }
451+
452+ return $ macro (...$ parameters );
453+ }
454+
455+ // Fallback to Fluent behavior if it's not a macro.
456+ $ this ->attributes [$ method ] = count ($ parameters ) > 0 ? reset ($ parameters ) : true ;
457+
458+ return $ this ;
459+ }
432460}
You can’t perform that action at this time.
0 commit comments