From a95ec73ac9b2ee7f0ca626a3f0ed598de0e32cfd Mon Sep 17 00:00:00 2001 From: Patrick Date: Tue, 22 Nov 2022 09:10:35 +0100 Subject: [PATCH] Add docs for `whenMissing()` --- requests.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/requests.md b/requests.md index 62c5380f64..f00b7d84be 100644 --- a/requests.md +++ b/requests.md @@ -414,6 +414,20 @@ To determine if a given key is absent from the request, you may use the `missing // } +The `whenMissing` method will execute the given closure if a value is absent from the request: + + $request->whenMissing('name', function ($input) { + // + }); + +A second closure may be passed to the `whenMissing` method that will be executed if the specified value is absent from the request: + + $request->whenMissing('name', function ($input) { + // The "name" value is absent... + }, function () { + // The "name" value is not absent... + }); + ### Merging Additional Input