Skip to content

Commit

Permalink
Add str() and string() to request object
Browse files Browse the repository at this point in the history
  • Loading branch information
cwilby authored and taylorotwell committed Apr 25, 2022
1 parent 10061f1 commit c9d34b7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Illuminate/Http/Concerns/InteractsWithInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,4 +542,28 @@ public function dump($keys = [])

return $this;
}

/**
* Retrieve input from the request as a stringable.
*
* @param string $key
* @param mixed $default
* @return \Illuminate\Support\Stringable
*/
public function str($key, $default = null)
{
return $this->string($key, $default);
}

/**
* Retrieve input from the request as a stringable.
*
* @param string $key
* @param mixed $default
* @return \Illuminate\Support\Stringable
*/
public function string($key, $default = null)
{
return str($this->input($key, $default));
}
}

0 comments on commit c9d34b7

Please sign in to comment.