Skip to content

Commit cf41c2f

Browse files
Merge branch '9.x'
2 parents a0dbdc8 + 7bcf724 commit cf41c2f

24 files changed

+490
-40
lines changed

src/Illuminate/Bus/UniqueLock.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ public function acquire($job)
3636
? $job->uniqueId()
3737
: ($job->uniqueId ?? '');
3838

39+
$uniqueFor = method_exists($job, 'uniqueFor')
40+
? $job->uniqueFor()
41+
: ($job->uniqueFor ?? 0);
42+
3943
$cache = method_exists($job, 'uniqueVia')
4044
? $job->uniqueVia()
4145
: $this->cache;
4246

4347
return (bool) $cache->lock(
4448
$key = 'laravel_unique_job:'.get_class($job).$uniqueId,
45-
$job->uniqueFor ?? 0
49+
$uniqueFor
4650
)->get();
4751
}
4852
}

src/Illuminate/Contracts/Debug/ExceptionHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public function render($request, Throwable $e);
4141
* @param \Symfony\Component\Console\Output\OutputInterface $output
4242
* @param \Throwable $e
4343
* @return void
44+
*
45+
* @internal This method is not meant to be used or overwritten outside the framework.
4446
*/
4547
public function renderForConsole($output, Throwable $e);
4648
}

src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ protected function addCastAttributesToArray(array $attributes, array $mutatedAtt
297297
$attributes[$key] = $this->serializeClassCastableAttribute($key, $attributes[$key]);
298298
}
299299

300-
if ($this->isEnumCastable($key)) {
300+
if ($this->isEnumCastable($key) && (! ($attributes[$key] ?? null) instanceof Arrayable)) {
301301
$attributes[$key] = isset($attributes[$key]) ? $attributes[$key]->value : null;
302302
}
303303

@@ -500,6 +500,10 @@ public function getRelationValue($key)
500500
*/
501501
public function isRelation($key)
502502
{
503+
if ($this->hasAttributeMutator($key)) {
504+
return false;
505+
}
506+
503507
return method_exists($this, $key) ||
504508
(static::$relationResolvers[get_class($this)][$key] ?? null);
505509
}

src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ public static function fromRawAttributes(Model $parent, $attributes, $table, $ex
7676

7777
$instance->timestamps = $instance->hasTimestampAttributes($attributes);
7878

79-
$instance->setRawAttributes($attributes, $exists);
79+
$instance->setRawAttributes(
80+
array_merge($instance->getRawOriginal(), $attributes), $exists
81+
);
8082

8183
return $instance;
8284
}

src/Illuminate/Database/Schema/Blueprint.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,38 @@ public function dropConstrainedForeignId($column)
413413
return $this->dropColumn($column);
414414
}
415415

416+
/**
417+
* Indicate that the given foreign key should be dropped.
418+
*
419+
* @param \Illuminate\Database\Eloquent\Model|string $model
420+
* @param string|null $column
421+
* @return \Illuminate\Support\Fluent
422+
*/
423+
public function dropForeignIdFor($model, $column = null)
424+
{
425+
if (is_string($model)) {
426+
$model = new $model;
427+
}
428+
429+
return $this->dropForeign([$column ?: $model->getForeignKey()]);
430+
}
431+
432+
/**
433+
* Indicate that the given foreign key should be dropped.
434+
*
435+
* @param \Illuminate\Database\Eloquent\Model|string $model
436+
* @param string|null $column
437+
* @return \Illuminate\Support\Fluent
438+
*/
439+
public function dropConstrainedForeignIdFor($model, $column = null)
440+
{
441+
if (is_string($model)) {
442+
$model = new $model;
443+
}
444+
445+
return $this->dropConstrainedForeignId($column ?: $model->getForeignKey());
446+
}
447+
416448
/**
417449
* Indicate that the given indexes should be renamed.
418450
*

src/Illuminate/Foundation/Bootstrap/HandleExceptions.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ public function bootstrap(Application $app)
6767
*/
6868
public function handleError($level, $message, $file = '', $line = 0, $context = [])
6969
{
70-
if (error_reporting() & $level) {
71-
if ($this->isDeprecation($level)) {
72-
return $this->handleDeprecation($message, $file, $line);
73-
}
70+
if ($this->isDeprecation($level)) {
71+
return $this->handleDeprecation($message, $file, $line);
72+
}
7473

74+
if (error_reporting() & $level) {
7575
throw new ErrorException($message, 0, $level, $file, $line);
7676
}
7777
}

src/Illuminate/Foundation/Console/RouteListCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,10 @@ protected function getMiddleware($route)
212212
*/
213213
protected function filterRoute(array $route)
214214
{
215-
if (($this->option('name') && ! str_contains($route['name'], $this->option('name'))) ||
216-
$this->option('path') && ! str_contains($route['uri'], $this->option('path')) ||
217-
$this->option('method') && ! str_contains($route['method'], strtoupper($this->option('method')))) {
215+
if (($this->option('name') && ! Str::contains($route['name'], $this->option('name'))) ||
216+
($this->option('path') && ! Str::contains($route['uri'], $this->option('path'))) ||
217+
($this->option('method') && ! Str::contains($route['method'], strtoupper($this->option('method')))) ||
218+
($this->option('domain') && ! Str::contains($route['domain'], $this->option('domain')))) {
218219
return;
219220
}
220221

@@ -418,6 +419,7 @@ protected function getOptions()
418419
['json', null, InputOption::VALUE_NONE, 'Output the route list as JSON'],
419420
['method', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by method'],
420421
['name', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by name'],
422+
['domain', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by domain'],
421423
['path', null, InputOption::VALUE_OPTIONAL, 'Only show routes matching the given path pattern'],
422424
['except-path', null, InputOption::VALUE_OPTIONAL, 'Do not display the routes matching the given path pattern'],
423425
['reverse', 'r', InputOption::VALUE_NONE, 'Reverse the ordering of the routes'],

src/Illuminate/Foundation/Exceptions/views/layout.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
html, body {
1212
background-color: #fff;
1313
color: #636b6f;
14-
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";;
14+
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
1515
font-weight: 100;
1616
height: 100vh;
1717
margin: 0;

src/Illuminate/Foundation/Testing/Concerns/InteractsWithDeprecationHandling.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected function withoutDeprecationHandling()
3838
{
3939
if ($this->originalDeprecationHandler == null) {
4040
$this->originalDeprecationHandler = set_error_handler(function ($level, $message, $file = '', $line = 0) {
41-
if (error_reporting() & $level) {
41+
if (in_array($level, [E_DEPRECATED, E_USER_DEPRECATED]) || (error_reporting() & $level)) {
4242
throw new ErrorException($message, 0, $level, $file, $line);
4343
}
4444
});

src/Illuminate/Http/Client/PendingRequest.php

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Http\Client\Events\ConnectionFailed;
1212
use Illuminate\Http\Client\Events\RequestSending;
1313
use Illuminate\Http\Client\Events\ResponseReceived;
14+
use Illuminate\Support\Arr;
1415
use Illuminate\Support\Collection;
1516
use Illuminate\Support\Str;
1617
use Illuminate\Support\Traits\Conditionable;
@@ -155,6 +156,20 @@ class PendingRequest
155156
*/
156157
protected $request;
157158

159+
/**
160+
* The Guzzle request options that are mergable via array_merge_recursive.
161+
*
162+
* @var array
163+
*/
164+
protected $mergableOptions = [
165+
'cookies',
166+
'form_params',
167+
'headers',
168+
'json',
169+
'multipart',
170+
'query',
171+
];
172+
158173
/**
159174
* Create a new HTTP Client instance.
160175
*
@@ -488,15 +503,18 @@ public function retry(int $times, int $sleep = 0, ?callable $when = null, bool $
488503
}
489504

490505
/**
491-
* Merge new options into the client.
506+
* Replace the specified options on the request.
492507
*
493508
* @param array $options
494509
* @return $this
495510
*/
496511
public function withOptions(array $options)
497512
{
498513
return tap($this, function ($request) use ($options) {
499-
return $this->options = array_merge_recursive($this->options, $options);
514+
return $this->options = array_replace_recursive(
515+
array_merge_recursive($this->options, Arr::only($options, $this->mergableOptions)),
516+
$options
517+
);
500518
});
501519
}
502520

@@ -1018,14 +1036,17 @@ public function runBeforeSendingCallbacks($request, array $options)
10181036
}
10191037

10201038
/**
1021-
* Merge the given options with the current request options.
1039+
* Replace the given options with the current request options.
10221040
*
10231041
* @param array $options
10241042
* @return array
10251043
*/
10261044
public function mergeOptions(...$options)
10271045
{
1028-
return array_merge_recursive($this->options, ...$options);
1046+
return array_replace_recursive(
1047+
array_merge_recursive($this->options, Arr::only($options, $this->mergableOptions)),
1048+
...$options
1049+
);
10291050
}
10301051

10311052
/**
@@ -1131,4 +1152,14 @@ public function setHandler($handler)
11311152

11321153
return $this;
11331154
}
1155+
1156+
/**
1157+
* Get the pending request options.
1158+
*
1159+
* @return array
1160+
*/
1161+
public function getOptions()
1162+
{
1163+
return $this->options;
1164+
}
11341165
}

0 commit comments

Comments
 (0)