Skip to content

Commit edde9ab

Browse files
committed
fix conflicts
2 parents 27cec6b + ff96905 commit edde9ab

24 files changed

+431
-133
lines changed

.github/workflows/facades.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
timeout_minutes: 5
3535
max_attempts: 5
3636
command: |
37-
composer config repositories.facade-documenter vcs [email protected]:laravel-labs/facade-documenter.git
37+
composer config repositories.facade-documenter vcs [email protected]:laravel/facade-documenter.git
3838
composer require --dev laravel/facade-documenter:dev-main --prefer-stable --prefer-dist --no-interaction --no-progress
3939
4040
- name: Update facade docblocks

src/Illuminate/Database/Eloquent/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ protected function addUpdatedAtColumn(array $values)
11661166
) {
11671167
$timestamp = $this->model->newInstance()
11681168
->forceFill([$column => $timestamp])
1169-
->getAttributes()[$column];
1169+
->getAttributes()[$column] ?? $timestamp;
11701170
}
11711171

11721172
$values = array_merge([$column => $timestamp], $values);

src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -672,19 +672,13 @@ public function createOrFirst(array $attributes = [], array $values = [], array
672672
*/
673673
public function updateOrCreate(array $attributes, array $values = [], array $joining = [], $touch = true)
674674
{
675-
if (is_null($instance = (clone $this)->where($attributes)->first())) {
676-
if (is_null($instance = $this->related->where($attributes)->first())) {
677-
return $this->create(array_merge($attributes, $values), $joining, $touch);
678-
} else {
679-
$this->attach($instance, $joining, $touch);
680-
}
681-
}
682-
683-
$instance->fill($values);
675+
return tap($this->firstOrCreate($attributes, $values, $joining, $touch), function ($instance) use ($values) {
676+
if (! $instance->wasRecentlyCreated) {
677+
$instance->fill($values);
684678

685-
$instance->save(['touch' => false]);
686-
687-
return $instance;
679+
$instance->save(['touch' => false]);
680+
}
681+
});
688682
}
689683

690684
/**

src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,11 @@ public function firstOrNew(array $attributes)
271271
*/
272272
public function updateOrCreate(array $attributes, array $values = [])
273273
{
274-
$instance = $this->firstOrNew($attributes);
275-
276-
$instance->fill($values)->save();
277-
278-
return $instance;
274+
return tap($this->firstOrCreate($attributes, $values), function ($instance) use ($values) {
275+
if (! $instance->wasRecentlyCreated) {
276+
$instance->fill($values)->save();
277+
}
278+
});
279279
}
280280

281281
/**

src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ public function createOrFirst(array $attributes = [], array $values = [])
267267
*/
268268
public function updateOrCreate(array $attributes, array $values = [])
269269
{
270-
return tap($this->firstOrNew($attributes), function ($instance) use ($values) {
271-
$instance->fill($values);
272-
273-
$instance->save();
270+
return tap($this->firstOrCreate($attributes, $values), function ($instance) use ($values) {
271+
if (! $instance->wasRecentlyCreated) {
272+
$instance->fill($values)->save();
273+
}
274274
});
275275
}
276276

src/Illuminate/Foundation/Exceptions/Handler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ protected function renderViaCallbacks($request, Throwable $e)
483483
*
484484
* @param \Illuminate\Http\Request $request
485485
* @param \Throwable $e
486-
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
486+
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
487487
*/
488488
protected function renderExceptionResponse($request, Throwable $e)
489489
{
@@ -497,7 +497,7 @@ protected function renderExceptionResponse($request, Throwable $e)
497497
*
498498
* @param \Illuminate\Http\Request $request
499499
* @param \Illuminate\Auth\AuthenticationException $exception
500-
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
500+
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
501501
*/
502502
protected function unauthenticated($request, AuthenticationException $exception)
503503
{
@@ -529,7 +529,7 @@ protected function convertValidationExceptionToResponse(ValidationException $e,
529529
*
530530
* @param \Illuminate\Http\Request $request
531531
* @param \Illuminate\Validation\ValidationException $exception
532-
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
532+
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
533533
*/
534534
protected function invalid($request, ValidationException $exception)
535535
{
@@ -570,7 +570,7 @@ protected function shouldReturnJson($request, Throwable $e)
570570
*
571571
* @param \Illuminate\Http\Request $request
572572
* @param \Throwable $e
573-
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
573+
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
574574
*/
575575
protected function prepareResponse($request, Throwable $e)
576576
{

src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,18 @@ public function __construct(Application $app)
4545
*/
4646
public function handle($request, Closure $next)
4747
{
48+
if ($this->inExceptArray($request)) {
49+
return $next($request);
50+
}
51+
4852
if ($this->app->maintenanceMode()->active()) {
4953
$data = $this->app->maintenanceMode()->data();
5054

5155
if (isset($data['secret']) && $request->path() === $data['secret']) {
5256
return $this->bypassResponse($data['secret']);
5357
}
5458

55-
if ($this->hasValidBypassCookie($request, $data) ||
56-
$this->inExceptArray($request)) {
59+
if ($this->hasValidBypassCookie($request, $data)) {
5760
return $next($request);
5861
}
5962

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace Illuminate\Queue\Failed;
4+
5+
interface CountableFailedJobProvider
6+
{
7+
/**
8+
* Count the failed jobs.
9+
*
10+
* @param string|null $connection
11+
* @param string|null $queue
12+
* @return int
13+
*/
14+
public function count($connection = null, $queue = null);
15+
}

src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
namespace Illuminate\Queue\Failed;
44

5-
use Countable;
65
use DateTimeInterface;
76
use Illuminate\Database\ConnectionResolverInterface;
87
use Illuminate\Support\Facades\Date;
98

10-
class DatabaseFailedJobProvider implements Countable, FailedJobProviderInterface, PrunableFailedJobProvider
9+
class DatabaseFailedJobProvider implements CountableFailedJobProvider, FailedJobProviderInterface, PrunableFailedJobProvider
1110
{
1211
/**
1312
* The connection resolver implementation.
@@ -133,10 +132,17 @@ public function prune(DateTimeInterface $before)
133132

134133
/**
135134
* Count the failed jobs.
135+
*
136+
* @param string|null $connection
137+
* @param string|null $queue
138+
* @return int
136139
*/
137-
public function count(): int
140+
public function count($connection = null, $queue = null)
138141
{
139-
return $this->getTable()->count();
142+
return $this->getTable()
143+
->when($connection, fn ($builder) => $builder->whereConnection($connection))
144+
->when($queue, fn ($builder) => $builder->whereQueue($queue))
145+
->count();
140146
}
141147

142148
/**

src/Illuminate/Queue/Failed/DatabaseUuidFailedJobProvider.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
namespace Illuminate\Queue\Failed;
44

5-
use Countable;
65
use DateTimeInterface;
76
use Illuminate\Database\ConnectionResolverInterface;
87
use Illuminate\Support\Facades\Date;
98

10-
class DatabaseUuidFailedJobProvider implements Countable, FailedJobProviderInterface, PrunableFailedJobProvider
9+
class DatabaseUuidFailedJobProvider implements CountableFailedJobProvider, FailedJobProviderInterface, PrunableFailedJobProvider
1110
{
1211
/**
1312
* The connection resolver implementation.
@@ -146,10 +145,17 @@ public function prune(DateTimeInterface $before)
146145

147146
/**
148147
* Count the failed jobs.
148+
*
149+
* @param string|null $connection
150+
* @param string|null $queue
151+
* @return int
149152
*/
150-
public function count(): int
153+
public function count($connection = null, $queue = null)
151154
{
152-
return $this->getTable()->count();
155+
return $this->getTable()
156+
->when($connection, fn ($builder) => $builder->whereConnection($connection))
157+
->when($queue, fn ($builder) => $builder->whereQueue($queue))
158+
->count();
153159
}
154160

155161
/**

0 commit comments

Comments
 (0)