66
77trait InteractsWithTheRequest
88{
9- public function setRequest (Request $ request ): static
10- {
11- $ this ->request = $ request ;
12-
13- return $ this ;
14- }
15-
16- public function request (): Request
9+ public function get (string $ key , mixed $ default = null ): mixed
1710 {
18- return $ this ->request ;
11+ return $ this ->request -> get ( $ key , $ default ) ;
1912 }
2013
2114 public function has (string |array $ key ): bool
2215 {
2316 return $ this ->request ->has ($ key );
2417 }
2518
26- public function hasAny (string |array $ keys ): bool
27- {
28- return $ this ->request ->hasAny ($ keys );
29- }
30-
3119 public function hasAll (array $ keys ): bool
3220 {
3321 foreach ($ keys as $ key ) {
@@ -39,9 +27,28 @@ public function hasAll(array $keys): bool
3927 return true ;
4028 }
4129
42- public function get (string $ key , mixed $ default = null ): mixed
30+ public function hasAny (string | array $ keys ): bool
4331 {
44- return $ this ->request ->get ($ key , $ default );
32+ return $ this ->request ->hasAny ($ keys );
33+ }
34+
35+ public function replace (string |array $ key , mixed $ value ): static
36+ {
37+ $ this ->set ($ key , $ value , replace: true );
38+
39+ return $ this ;
40+ }
41+
42+ public function request (): Request
43+ {
44+ return $ this ->request ;
45+ }
46+
47+ public function setRequest (Request $ request ): static
48+ {
49+ $ this ->request = $ request ;
50+
51+ return $ this ;
4552 }
4653
4754 public function set (string |array $ key , mixed $ value = null , bool $ replace = false ): static
@@ -89,11 +96,4 @@ public function setIfMissing(string|array $key, mixed $value): static
8996
9097 return $ this ;
9198 }
92-
93- public function replace (string |array $ key , mixed $ value ): static
94- {
95- $ this ->set ($ key , $ value , replace: true );
96-
97- return $ this ;
98- }
9999}
0 commit comments