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();
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()
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)
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.
# 11.17.0
- [10.x] Fix PHP_CLI_SERVER_WORKERS warning by suppressing it by @pelomedusa in #52094
- [11.x] Use
Command::FAILURE
fordb:wipe
command by @siarheipashkevich in #52152 - [11.x] Update outdated config files by @TENIOS in #52150
- [11.x] Fix 'pushProcessor method not found on LoggerInterface' error by @cosmastech in #52117
- [11.x] Use
Command::FAILURE
formigrate:fresh
command by @siarheipashkevich in #52153 - Improve accuracy of
Collection::isEmpty
andisNotEmpty
assertions by @spawnia in #52184 - [11.x] Fix return for ApplicationBuilder:: withCommandRouting method by @seriquynh in #52181
- [11.x] Refactor: Replace get_called_class() with static::class for consistency by @fernandokbs in #52173
- [11.x] Improve readability of SQLite schema dumps by @bakerkretzmar in #52172
- [11.x] Allow non-
ContextualAttribute
attributes to have anafter
callback by @innocenzi in #52167 - [11.x] Ignoring column definitions when determining if a blueprint has a create command by @kingsven in #52177
- Add specify exceptions for exceptions handling the vite manifest file by @SamuelWei in #52169
- [11.x] fix: Model newCollection generics; feat: add HasCollection trait by @calebdw in #52171
- Add whereLike clause to query builder by @einar-hansen in #52147
- [11.x] Implement HasV7Uuids to use with MariaDB native uuid data type by @Karem-sobhy in #52029
- [11.x] Rename
Model::$collection
to$collectionClass
by @GromNaN in #52186 - [11.x] Allow microsecond travel by @timacdonald in #52190
- [11.x] fix: Model/JsonResource::toJson should not fail with prior json errors by @calebdw in #52188
- [11.x] Fix SQL Server tests by @hafezdivandari in #52222
- [11.x] Inspect exception of assertThrows by @gdebrauwer in #52224
- [10.x] Backport #51615 by @GrahamCampbell in #52215
- [11.x] fix: Request::json() json errors when decoding empty string by @calebdw in #52204
- [11.x] Reduce the number of queries with
Cache::many
andCache::putMany
methods in the database driver by @tonysm in #52209 - Add method
QueryExecuted::toRawSql()
by @spawnia in #52192 - [11.x] Support lower version of Carbon by @timacdonald in #52233
- [11.x] Prevent bug (🐛) emoji on
Collection
/Dumpable
dd
method by @jessarcher in #52234