Laravel 6.12.0 Released

Published on by

Laravel 6.12.0 Released image

The Laravel team released v6.12.0 this week with the ability to load factories from a package, dump test session data, and many other features! This release is jam-packed with contributions that add some sweet syntactic sugar for repetitive things like filtering a request input as a Boolean.

Here’s a look at some of the highlight new features:

Load Factories from a Package

Gergo D. Nagy contributed a pull request to load factory files in a service provider. Packages can benefit from using existing factories from a package instead of recreating them:

// from a service provider...
$this->loadFactoriesFrom('source/database/factories');
 
$this->loadFactoriesFrom([
'source_one/database/factories',
'source_two/database/factories',
]);

Dump Session in a Test Response

Andrew Brown contributed a dumpSession() method to the TestResponse class that provides convenience around dumping the whole session or specific keys:

$response->dumpSession();
$response->dumpSession('example');
$response->dumpSession(['example', 'example2']);

Str::isUuid() Helper

@leonhh contributed a isUuid() string helper by extracting the logic from the ValidatesAttributes trait used the validate UUIDs:

// Returns true
Str::isUuid('a0a2a2d2-0b87-4a18-83f2-2529882be2de');
 
// Returns false
Str::isUuid('laravel');

Request Boolean Method

Lasse Rafn contributed a Request::boolean() method which takes input and filters it through filter_var to determine if the value is boolean. Here are some examples:

$request = Request::create('/', 'GET', [
'example1' => 'true',
'example2' => 'false',
'checked' => 1,
'checked2' => '1',
'unchecked' => 0,
'unchecked2' => '0',
'name' => 'Jane Doe'
]);
 
$request->boolean('example1'); // true
$request->boolean('example2'); // false
$request->boolean('checked'); // true
$request->boolean('checked2'); // true
$request->boolean('unchecked'); // false
$request->boolean('unchecked2'); // false
$request->boolean('name'); // false

Factory Builder createMany()

Mohamed Benhida contributed the factory createMany() method, which aids in creating multiple records with custom data:

// Before
factory(User::class)->create([
'name' => 'Taylor',
]);
 
factory(User::class)->create([
'name' => 'John',
]);
 
// After
factory(User::class)->createMany([
['name' => 'Taylor'],
['name' => 'John'],
]);

You can see the full list of new features and updates below and the whole diff between 6.11.0 and 6.12.0 on GitHub. The full release notes for Laravel 6.0 are available in the GitHub v6 changelog:

v6.12.0 (2020-01-21)

Added

  • Added ServiceProvider::loadFactoriesFrom() method (#31133)
  • Added TestResponse::dumpSession() method (#31131)
  • Added Str::isUuid() method (#31148)
  • Restored phpunit 7 support (#31113)
  • Added Request::boolean() method (#31160)
  • Added Database\Eloquent\FactoryBuilder::createMany() (#31171, 6553d59)
  • Added missing options for PhpRedis (#31182)

Fixed

  • Fixed Cache\RedisLock::acquire() (#31168, 8683a3d)
  • Fixed database url parsing for connections with no database specified (#31185)
  • Prevent ambiguous column with table name prefix (#31174)

Optimization

  • Fixed memory usage on downloading large files (#31163)

Changed

  • Replace Event Dispatcher in resolved cache repositories when Event::fake() is used (#31119, 0a70beb)
Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
LaraJobs logo

LaraJobs

The official Laravel job board

LaraJobs
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Rector logo

Rector

Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

Rector
MongoDB logo

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB

The latest

View all →
Add Comments to your Laravel Application with the Commenter Package image

Add Comments to your Laravel Application with the Commenter Package

Read article
Laravel Advanced String Package image

Laravel Advanced String Package

Read article
Take the Annual State of Laravel 2024 Survey image

Take the Annual State of Laravel 2024 Survey

Read article
Upload Files Using Filepond in Livewire Components image

Upload Files Using Filepond in Livewire Components

Read article
The Best Laravel Tutorials and Resources for Developers image

The Best Laravel Tutorials and Resources for Developers

Read article
Introducing Built with Laravel image

Introducing Built with Laravel

Read article