From 75b610936fa02516a5d44e8029fe96c19add54cf Mon Sep 17 00:00:00 2001 From: Pascal Baljet Date: Fri, 2 Oct 2020 20:31:56 +0200 Subject: [PATCH] [8.x] Added whenHas() and whenFilled() to Request docs --- requests.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/requests.md b/requests.md index 2c0bcb36b9..c1902dd549 100644 --- a/requests.md +++ b/requests.md @@ -233,6 +233,12 @@ When given an array, the `has` method will determine if all of the specified val // } +The `whenHas` method will execute the given callback if a value is present on the request: + + $request->whenHas('name', function ($input) { + // + }); + The `hasAny` method returns `true` if any of the specified values are present: if ($request->hasAny(['name', 'email'])) { @@ -245,6 +251,12 @@ If you would like to determine if a value is present on the request and is not e // } +The `whenFilled` method will execute the given callback if a value is present on the request and is not empty: + + $request->whenFilled('name', function ($input) { + // + }); + To determine if a given key is absent from the request, you may use the `missing` method: if ($request->missing('name')) {