Skip to content

Commit 71d7180

Browse files
committed
Add attribute to Eloquent builder
1 parent 7e4cdd5 commit 71d7180

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Eloquent/Builder.php

Lines changed: 14 additions & 2 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,8 @@ public function raw($value = null)
270276
return $results;
271277
}
272278

279+
/** @inheritdoc */
280+
#[Override]
273281
public function firstOrCreate(array $attributes = [], array $values = [])
274282
{
275283
$instance = (clone $this)->where($attributes)->first();
@@ -285,6 +293,8 @@ public function firstOrCreate(array $attributes = [], array $values = [])
285293
return $this->createOrFirst($attributes, $values);
286294
}
287295

296+
/** @inheritdoc */
297+
#[Override]
288298
public function createOrFirst(array $attributes = [], array $values = [])
289299
{
290300
// The duplicate key error would abort the transaction. Using the regular firstOrCreate in that case.
@@ -309,8 +319,9 @@ public function createOrFirst(array $attributes = [], array $values = [])
309319
* will be reverted
310320
* Issue in laravel/frawework https://github.com/laravel/framework/issues/27791.
311321
*
312-
* @return array
322+
* @inheritdoc
313323
*/
324+
#[Override]
314325
protected function addUpdatedAtColumn(array $values)
315326
{
316327
if (! $this->model->usesTimestamps() || $this->model->getUpdatedAtColumn() === null) {
@@ -332,6 +343,7 @@ public function getConnection(): Connection
332343
}
333344

334345
/** @inheritdoc */
346+
#[Override]
335347
protected function ensureOrderForCursorPagination($shouldReverse = false)
336348
{
337349
if (empty($this->query->orders)) {

0 commit comments

Comments
 (0)