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 Full-Stack Developer (PHP+JS)
Remote
The Interaction Design Foundation
Senior Laravel Developer
Remote
Sonar
Laravel / Vue.JS Developer - Join an amazing team!
Remote
JTR Solutions
Mid / Sen. Software Engineer
Clearwater, FL
ShineOn
Remote PHP / Laravel Developer
Remote
SpringboardVR
Senior PHP/Laravel Developer: Your Dream Work Environment
Remote
iPhone Photography School
Senior Laravel Developer
Leidseplein, Amsterdam
Orderchamp.com