Skip to content

Commit c9d34b7

Browse files
cwilbytaylorotwell
authored andcommitted
Add str() and string() to request object
1 parent 10061f1 commit c9d34b7

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/Illuminate/Http/Concerns/InteractsWithInput.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,4 +542,28 @@ public function dump($keys = [])
542542

543543
return $this;
544544
}
545+
546+
/**
547+
* Retrieve input from the request as a stringable.
548+
*
549+
* @param string $key
550+
* @param mixed $default
551+
* @return \Illuminate\Support\Stringable
552+
*/
553+
public function str($key, $default = null)
554+
{
555+
return $this->string($key, $default);
556+
}
557+
558+
/**
559+
* Retrieve input from the request as a stringable.
560+
*
561+
* @param string $key
562+
* @param mixed $default
563+
* @return \Illuminate\Support\Stringable
564+
*/
565+
public function string($key, $default = null)
566+
{
567+
return str($this->input($key, $default));
568+
}
545569
}

0 commit comments

Comments
 (0)