Running a Query
How to execute a custom query you created with the query builder.
Executing queries
$query = QueryBuilder::create()
->select('firstName', 'lastName')
->from(Contact::class)
->where('lastName', '=', 'Skywalker')
->buildSelectQuery();
$contacts = $repository->executeQuery($query);
// $contacts now contains a list of partially
// hydrated Contact objects for each matching
// contact.$query = QueryBuilder::create()
->delete(Contact::class)
->where('isPermanent', '=', false)
->buildDeleteQuery();
$affectedCount = $repository->executeQuery($query);
// $affectedCount now contains the count of how
// many records were deleted.Queries with find methods
Last updated