$collection->join()
Joins the collection elements into a string, optionally using a Closure to transform the elements
$collection->join(string $separator = ', ', Closure|null $as = null): string
Parameters
Name | Type | Default |
---|---|---|
$separator | string |
', '
|
$as | Closure ornull |
null
|
Return type
string
This method modifies the existing $collection
object it is applied to and returns it again.
Parent class
Examples
$page->children()->join(' | ', fn ($child) => $child->venue());
$page->children()->join(as: fn ($child) => snippet('child', ['page' => $child], return: true));