Laravel0Laravel 9.11 Released | Laravel News

[ad_1]

The Laravel team released 9.11 with an array join method, methods to check the existence of validated input, opt-in deprecation logging, and more:

Add Arr::join() Method

Daniel Eckermann contributed a Arr::join() method similar to the Collection::join() method:

1$stack = ['Tailwind', 'Alpine', 'Laravel', 'Livewire'];

2 

3// Tailwind, Alpine, Laravel and Livewire

4Arr::join($stack, ', ', ' and ');

5 

6// Or if you appreciate the oxford comma :)

7// Tailwind, Alpine, Laravel, and Livewire

8Arr::join($stack, ', ', ', and ');

Methods to Check the Existence of Validated Input Data

Sam Carré contributed two methods to the ValidatedInput class to check for the existence of validated input data. These methods are like $request->has() and $request->missing(), except only against validated data:

1$validatedName = $request->safe()->has('name'); // True

2$validatedAge = $request->safe()->has('age'); // False

3 

4$validatedName = $request->safe()->missing('name'); // False

5$validatedAge = $request->safe()->missing('age'); // True

6 

7// Check each key in the array

8$validatedName = $request->safe()->has(['name', 'age']);

Deprecation Stack Trace Config Option

Dries Vints contributed to making deprecation error stack traces opt-in rather than enabled by default. Check out Pull Request #42235 and #42191 for further details on logging deprecation errors.

Release Notes

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

v9.11.0

Added

  • Added Illuminate/Collections/Arr::join() (#42197)
  • Added has and missing methods to ValidatedInput (#42184)
  • Added deprecation stack trace config option (#42235)

Fixed

  • Fix deprecation issue with translator and empty rules (#42216, #42213)

Changed

  • Improve EventFake::assertListening() support for subscribers (#42193)

[ad_2]

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *