Skip to content

Add documentation for retrieving input values as integers to requests.md #9894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ Instead of retrieving the request's input data as a primitive `string`, you may

$name = $request->string('name')->trim();

<a name="retrieving-integer-input-values"></a>
#### Retrieving Integer Input Values

To retrieve input values as integers, you may use the `integer` method. This method will attempt to cast the input value to an integer. If the input is not present or the cast fails, it will return the default value you specify. This is particularly useful for pagination or other numeric inputs:

$perPage = $request->integer('per_page');

<a name="retrieving-boolean-input-values"></a>
#### Retrieving Boolean Input Values

Expand Down