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 Quality Assurance Engineer
Remote
Bisnow Media
Senior PHP/Laravel Developer: Your Dream Work Environment
Remote
iPhone Photography School
Senior Software Engineer
Remote or San Francisco
Curology
Laravel Developer
Las Vegas, NV
V Shred
R&D Developer
Denver, CO
booj
Full-Stack Developer
Paris, France
Wingly
Full Stack Developer
Remote US-Only
atlasMind