Skip to content

Commit

Permalink
[11.x] Add Request::fluent method (#53662)
Browse files Browse the repository at this point in the history
* Fix typo

* Add fluent method to transform request instance into fluent

* Add missing supported type

* Update InteractsWithInput.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
stevebauman and taylorotwell authored Nov 25, 2024
1 parent cfa26fb commit 018d778
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/Illuminate/Http/Concerns/InteractsWithInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,17 @@ public function collect($key = null)
return collect(is_array($key) ? $this->only($key) : $this->input($key));
}

/**
* Retrieve input from the request as a Fluent object instance.
*
* @param array|string|null $key
* @return \Illuminate\Support\Fluent
*/
public function fluent($key = null)
{
return fluent(is_array($key) ? $this->only($key) : $this->input($key));
}

/**
* Get a subset containing the provided keys with values from the input data.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function filled($value)

if (! function_exists('fluent')) {
/**
* Create an Fluent object from the given value.
* Create a Fluent object from the given value.
*
* @param object|array $value
* @return \Illuminate\Support\Fluent
Expand Down

0 comments on commit 018d778

Please sign in to comment.