Macroable

trait Macroable (View source)

Properties

static protected array $macros The registered string macros.

Methods

static void macro(string $name, object|callable $macro)

Register a custom macro.

static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool hasMacro(string $name)

Checks if macro is registered.

static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Details

static void macro(string $name, object|callable $macro)

Register a custom macro.

Parameters

string $name
object|callable $macro

Return Value

void

static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Support/Traits/Macroable.html