Back to Blog

Rule::array() and whereJsonOverlaps() for MySQL in Laravel 11.7

Julian Beaujardin
Julian Beaujardin May 7th, 2024

This week, the Laravel team released v11.7, with a Rule::array() validation method, a whereJsonOverlaps() method for MySQL, a Slack OpenID provider for Laravel Socialite, and more.

Introduce the Rule::array() Method

Jakub Potocký contributed the Rule::array() method used to validate multiple array keys using the array validation rule. This method enables using this rule with arrays and collections without having the concatenate dynamic values:

use Illuminate\Validation\Rule;

// Before
['array:' . MyBackedEnum::VALUE->value . ',' . MyBackedEnum::VALUE_2->value];

// After examples
Rule::array('key_1', 'key_2', 'key_3');
Rule::array(['key_1', 'key_2', 'key_3']);
Rule::array(collect(['key_1', 'key_2', 'key_3']));
Rule::array([UnitEnum::key_1, UnitEnum::key_2, UnitEnum::key_3]);
Rule::array([BackedEnum::key_1, BackedEnum::key_2, BackedEnum::key_3]);

See Pull Request #51250 for full details.

Stringable Support in blank() and filled() Helpers

Stefan R. contributed support for Stringable values in the blank() and filled() helpers:

// true
filled(str('FooBar '));

// true
blank(str('  '));

Add "whereJsonOverlaps()" for MySQL

Benjamin Ayles contributed support for MySQL's json_overlaps feature that compares two JSON documents:

User::whereJsonOverlaps('languages', ['en', 'fr'])->exists();
User::whereJsonDoesntOverlap('languages', ['en', 'fr'])->exists();

See Pull Request #51288 for more details and discussion.

Add PasswordResetLinkSent Event

Matt Jones contributed a new event called PasswordResetLinkSent which fires when a password reset link is sent. See Pull Request #51253 for more details.

Release notes

You can see the complete list of new features and updates below and the diff between 11.6.0 and 11.7.0 on GitHub. The following release notes are directly from the changelog