Laravel 5.4.17 is released
News / updated: April 03, 2017

Laravel 5.4.17 is released

Today Laravel released v5.4.17 and it includes several new features including a Collection Times method, improvements to the migrations, and more.

Collection::Times()

Thanks to Joseph Silber the Collection system received a new “Times” method that allows you to do things like this:

$slugs = Collection::times(5, function ($number) {
return 'slug-'.$number;
});

// ['slug-1', 'slug-2', 'slug-3', 'slug-4', 'slug-5'];

Or inside Model Factories:

$products = Collection::times(5, function ($number) {
return factory(Product::class)->create(['name' => 'Product #'.$number]);
});

Laravel Migrations

When creating migrations, Laravel wanted you to define both an “up” method and a “down”. This way the system would know what needs to be changed and reset depending on the direction you are going. Now in v5.4.17, migrations will only call the “up” or “down” if the method exists.

Other V5.4.17 Changes include:

Laravel News Partners

Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.