Skip to content

Conversation

@CupOfTea696
Copy link
Contributor

Follow up on #19276

Allows calls to Collection::times without the callback parameter, so you can create simple range collections and maybe modify them manually later with map or mapWithKeys methods.

Use case example:

Collection::times(2)->mapWithKeys(function ($number) {
    return ['slug-'.$number => 'Title '.$number];
})->toArray();


/**
 *   [
 *       ['slug-1' => 'Title 1'],
 *       ['slug-2' => 'Title 2']
 *   ]
 */

@taylorotwell taylorotwell merged commit 07ea288 into laravel:5.4 May 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants