News

Laravel 5.7.15 Released

Published
Laravel 5.7.15 Released image

Laravel 5.7.15 is available with a new validation rule and Eloquent relationship getters — first, the starts_with validation rule which allows you to check that an input starts with a string.

$request->validate([
'greeting' => 'starts_with:hello',
]);

You can also pass multiple strings, in which the rule will pass if at least one matches the input:

$request->validate([
'greeting' => 'starts_with:hello,hola',
]);

Next, the date_equals validation rule is now translatable, and you should update your resources/lang/en/validation.php file with the following:

'date_equals' => 'The :attribute must be a date equal to :date.',

You can see the pull request to laravel/laravel for the new translation key.

New relationship getters are available in this release including:

  • BelongsToMany::getParentKeyName
  • BelongsToMany::getRelatedKeyName
  • HasManyThrough::getFirstKeyName
  • HasManyThrough::getForeignKeyName
  • HasManyThrough::getSecondLocalKeyName
  • HasOneOrMany::getLocalKeyName
  • MorphToMany::getInverse

You can see the full diff between 5.7.14 and 5.7.15 on GitHub, and the full release notes below from the 5.7 changelog:

v5.7.15

Added

  • Added date_equals validation message (#26584)
  • Added starts_with validation rule (#26612)
  • Added relationship getters BelongsToMany::getParentKeyName, BelongsToMany::getRelatedKeyName, HasManyThrough::getFirstKeyName, HasManyThrough::getForeignKeyName, HasManyThrough::getSecondLocalKeyName, HasOneOrMany::getLocalKeyName, MorphToMany::getInverse (#26607)
  • Make ResourceCollection countable (#26595)

Fixed

  • Fixed duplicate validation issue in FormRequest::validated method (#26604)
  • Prevent breaking eager loading with string keys (#26622)
Paul Redmond photo

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

Filed in

Sponsored

laravelcloud logo
Laravel Cloud

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

Visit Laravel Cloud

The latest

View all →
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article
Laravel AI SDK Adds Human-in-the-Loop Tool Approval image

Laravel AI SDK Adds Human-in-the-Loop Tool Approval

Read article
Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals image

Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals

Read article
Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs image

Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs

Read article
Blade Formatting in Laravel Pint image

Blade Formatting in Laravel Pint

Read article
Inertia DevTools Is Now on the Chrome Web Store image

Inertia DevTools Is Now on the Chrome Web Store

Read article