Skip to content

Commit ede8012

Browse files
committed
Add attribute to Eloquent builder
1 parent 50f52eb commit ede8012

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Eloquent/Builder.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use MongoDB\Laravel\Helpers\QueriesRelationships;
1919
use MongoDB\Laravel\Query\AggregationBuilder;
2020
use MongoDB\Model\BSONDocument;
21+
use Override;
2122

2223
use function array_key_exists;
2324
use function array_map;
@@ -127,7 +128,12 @@ public function vectorSearch(
127128
return $this->model->hydrate($results->all());
128129
}
129130

130-
/** @inheritdoc */
131+
/**
132+
* @param array $options
133+
*
134+
* @inheritdoc
135+
*/
136+
#[Override]
131137
public function update(array $values, array $options = [])
132138
{
133139
// Intercept operations on embedded models and delegate logic
@@ -270,6 +276,7 @@ public function raw($value = null)
270276
return $results;
271277
}
272278

279+
#[Override]
273280
public function firstOrCreate(array $attributes = [], array $values = [])
274281
{
275282
$instance = (clone $this)->where($attributes)->first();
@@ -285,6 +292,7 @@ public function firstOrCreate(array $attributes = [], array $values = [])
285292
return $this->createOrFirst($attributes, $values);
286293
}
287294

295+
#[Override]
288296
public function createOrFirst(array $attributes = [], array $values = [])
289297
{
290298
// The duplicate key error would abort the transaction. Using the regular firstOrCreate in that case.
@@ -308,9 +316,8 @@ public function createOrFirst(array $attributes = [], array $values = [])
308316
* TODO Remove if https://github.com/laravel/framework/commit/6484744326531829341e1ff886cc9b628b20d73e
309317
* will be reverted
310318
* Issue in laravel/frawework https://github.com/laravel/framework/issues/27791.
311-
*
312-
* @return array
313319
*/
320+
#[Override]
314321
protected function addUpdatedAtColumn(array $values)
315322
{
316323
if (! $this->model->usesTimestamps() || $this->model->getUpdatedAtColumn() === null) {
@@ -332,6 +339,7 @@ public function getConnection(): Connection
332339
}
333340

334341
/** @inheritdoc */
342+
#[Override]
335343
protected function ensureOrderForCursorPagination($shouldReverse = false)
336344
{
337345
if (empty($this->query->orders)) {

0 commit comments

Comments
 (0)