Back to Blog

Laravel 10.32 Released

Julian Beaujardin
Julian Beaujardin Reference: Laravel News November 15th, 2023

This week, the Laravel team released v10.32, with new conditional push Blade directives, conditional "present" validation rules, and more. Laravel 10 saw 15 individual contributions, including updates, fixes, and improvements. Here is a bit more info about the new features introduced this week:

Add @pushElseIf and @pushElse Blade directives (v10.32.1)

Jason McCreary contributed the @pushElseIf and @pushElse Blade directives to accompany @pushIf and complete a full set of conditional push directives:

@pushIf($type == 'tailwind', 'css')
  <link href="public/css/tailwind.css" media="all" rel="stylesheet">
@elsePushIf($type == 'boostrap', 'css')
  <link href="public/css/bootstrap.css" media="all" rel="stylesheet">
@elsePush('css')
  <link href="public/css/app.css" media="all" rel="stylesheet">
@pushEndIf

See Pull Request #48990 to learn more about the implementation.

Additional "present" validation rules

@diamondobama contributed additional "present" validation rules to validate data based on the presence of other fields. Previously, the present validation rule would validate that a given field was present in the request.

Now we have the following "present" rules:

  • present_if
  • present_unless
  • present_with
  • present_with_all

Here's an example using the present_if validation rule:

use Illuminate\Support\Facades\Validator;

Validator::validate(
    ['foo' => 1],
    ['foo' => 'required', 'bar' => 'present_if:foo,1']
); // ValidationException

Validator::validate(
    ['foo' => 1, 'bar' => null],
    ['foo' => 'required', 'bar' => 'present_if:foo,1']
); // [ "foo" => 1, "bar" => null ]

Check out the tests in Pull Request #48908 for examples of each rule.

Release notes

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

v10.32.1

v10.32.0

  • Update PendingRequest.php by @mattkingshott in #48939
  • Change array_key_exists with null coalescing assignment operator in FilesystemAdapter by @miladev95 in #48943
  • Use container to resolve email validator class by @orkhanahmadov in #48942
  • Added getGlobalMiddleware method to HTTP Client Factory by @pascalbaljet in #48950
  • Detect MySQL read-only mode error as a lost connection by @cosmastech in #48937
  • Adds more implicit validation rules for present based on other fields by @diamondobama in #48908
  • Refactor set_error_handler callback to use arrow function in InteractsWithDeprecationHandling by @miladev95 in #48954
  • Test Improvements by @crynobone in #48962
  • Fix issue that prevents BladeCompiler to raise an exception when temporal compiled blade template is not found. by @juanparati in #48957
  • Fix how nested transaction callbacks are handled by @mateusjatenee in #48859
  • Fixes Batch Callbacks not triggering if job timeout while in transaction by @crynobone in #48961
  • Expressions in migration computations fail by @tpetry in #48976
  • Fixes Exception: Cannot traverse an already closed generator when running Arr::first with an empty generator and no callback by @moshe-autoleadstar in #48979
  • Fixes issue with stderr when there was "]" character. by @nikopeikrishvili in #48975
  • Fix Postgres cache store failed to put exist cache in transaction by @xdevor in #48968