Handles dispatching of methods against all items in the collection.
public invoke ( string $method, array $params = [], array $options = [] ) : mixed | ||
$method | string | The name of the method to call on each instance in the collection. |
$params | array | The parameters to pass on each method call. |
$options | array | Specifies options for how to run the given method against the object collection. The available options are: - `'collect'`: If `true`, the results of this method call will be returned wrapped in a new `Collection` object or subclass. - `'merge'`: Used primarily if the method being invoked returns an array. If set to `true`, merges all results arrays into one. |
return | mixed | Returns either an array of the return values of the methods, or the return values wrapped in a `Collection` instance. |