Laravel 5.4.17 is released

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:


Filed in: News / Collections / Migrations / Releases


Newsletter

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

Laravel News Partners

Laravel Jobs

Senior PHP/Laravel Developer: Your Dream Work Environment
Remote
iPhone Photography School
In-house Laravel Developer.
Gold Coast / Australia
MXstore
Laravel Developer
Oak Brook, IL
Tidal Commerce
Senior Backend Engineer
Santa Monica only
Saatchi Art
Senior Laravel Developer
San Francisco
Stitch Labs
Senior Software Developer
South Jordan, UT
Lendio
Full-Stack Developer
Paris, France
Wingly