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.

image
Tinkerwell

Version 4 of Tinkerwell is available now. Get the most popular PHP scratchpad with all its new features and simplify your development workflow today.

Visit Tinkerwell
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

Bespoke software solutions built for your business. We ♥ Laravel

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
All Green logo

All Green

All Green is a SaaS test runner that can execute your whole Laravel test suite in mere seconds so that you don't get blocked – you get feedback almost instantly and you can deploy to production very quickly.

All Green
Larafast: Laravel SaaS Starter Kit logo

Larafast: Laravel SaaS Starter Kit

Larafast is a Laravel SaaS Starter Kit with ready-to-go features for Payments, Auth, Admin, Blog, SEO, and beautiful themes. Available with VILT and TALL stacks.

Larafast: Laravel SaaS Starter Kit
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

The latest

View all →
Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4 image

Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4

Read article
Basset is an alternative way to load CSS & JS assets image

Basset is an alternative way to load CSS & JS assets

Read article
Integrate Laravel with Stripe Connect Using This Package image

Integrate Laravel with Stripe Connect Using This Package

Read article
The Random package generates cryptographically secure random values image

The Random package generates cryptographically secure random values

Read article
Automatic Blade Formatting on Save in PhpStorm image

Automatic Blade Formatting on Save in PhpStorm

Read article
PhpStorm 2024.1 Is Released With a Integrated Terminal, Local AI Code Completion, and More image

PhpStorm 2024.1 Is Released With a Integrated Terminal, Local AI Code Completion, and More

Read article