Returns the first non-empty value in the collection after a filter is applied, or rewinds the
collection and returns the first value.
public first ( callback $filter = null ) : mixed | ||
$filter | callback | A closure through which collection values will be passed. If the return value of this function is non-empty, it will be returned as the result of the method call. If `null`, the collection is rewound (see `rewind()`) and the first item is returned. |
return | mixed | Returns the first non-empty collection value returned from `$filter`. |