Skip to content

Commit 6fe51dd

Browse files
authored
[13.x] Copy Symfony\Component\HttpFoundation\Request::get() (#58081)
functionality to avoid breaking changes. Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent 0ec53ba commit 6fe51dd

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/Illuminate/Http/Request.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,21 @@ public function replace(array $input)
433433
* @param mixed $default
434434
* @return mixed
435435
*/
436-
#[\Override]
437436
public function get(string $key, mixed $default = null): mixed
438437
{
439-
return parent::get($key, $default);
438+
if ($this !== $result = $this->attributes->get($key, $this)) {
439+
return $result;
440+
}
441+
442+
if ($this->query->has($key)) {
443+
return $this->query->all()[$key];
444+
}
445+
446+
if ($this->request->has($key)) {
447+
return $this->request->all()[$key];
448+
}
449+
450+
return $default;
440451
}
441452

442453
/**

0 commit comments

Comments
 (0)