With the release of laravel 11.17.0 we have,

`whereLike` clause to the query builder

Contributed by Einar Hansen, this PR introduces new methods to the Query Builder for performing LIKE queries with control over case sensitivity.

  • whereLike($column, $value, $caseSensitive = false): Performs a LIKE query with optional case sensitivity
  • whereNotLike($column, $value, $caseSensitive = false): Performs a NOT LIKE query with optional case sensitivity
  • orWhereLike($column, $value, $caseSensitive = false): Adds an OR LIKE clause with optional case sensitivity
  • orWhereNotLike($column, $value, $caseSensitive = false): Adds an OR NOT LIKE clause with optional case sensitivity

Example

// without case sensitivity
$users = DB::table('users')
    ->whereLike('email', '[email protected]')
    ->get();

// with case sensitivity
$users = DB::table('users')
    ->whereLike('email', '[email protected]', true)
    ->get();

Here is the link to PR

Allow microsecond travel

before the release of laravel 11.17.0, millisecond was the highest precision in the travel function. Now Contributed by Tim MacDonald the precision goes to microseconds.

travel(5)->microseconds()

Here is the link to PR

Add method `QueryExecuted::toRawSql()`

Added. by Benedikt Franke, this functions make the Debugging SQL a bit easy.

// $query->tosql()
insert into `competence_detail_criteria` (`competence_criteria_id`, `competence_detail_id`, `valid_from`, `valid_to`, `userid`, `first_id`) values (?, ?, ?, ?, ?, ?)

// $query->toRawSql()
insert into `competence_detail_criteria` (`competence_criteria_id`, `competence_detail_id`, `valid_from`, `valid_to`, `userid`, `first_id`) values (4, 1, '2024-07-19 11:10:29', '9999-12-31 23:55:55', 1, 0)

Here is the link to PR

Reduce the number of queries with `Cache::many` and `Cache::putMany` methods

The previous implementation was doing a database query for each key, but now thanks to Tony Messias it does only 1 query for all (2 if it finds expired keys)

In his own words

I was exploring fragment caching on my views... then found out the many method of the database cache driver was doing a database query for each cache key. The new implementation does only one query for all keys and then builds the results from what it finds. Additionally, it deletes the expired keys it finds in a single query as well.
The putMany had a similar story: it was doing a database query for each key. Now, it only does one upsert.

I made the get and put methods use the many and put ones behind the scenes so we can rely on the same implementation.

Here is the link to PR

More from Laravel 11

# 11.17.0