From 897de68760f287d7c290b3c2c08e4683f3404f06 Mon Sep 17 00:00:00 2001 From: Aden Fraser Date: Thu, 14 Apr 2016 14:26:11 +0100 Subject: [PATCH] Adds an Intersect Method on the Request Class Allows intersection of request input with provided array of input keys (or method arguments). --- src/Illuminate/Http/Request.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index 04809b711c98..edcab364e5dc 100755 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -375,6 +375,17 @@ public function except($keys) return $results; } + /** + * Intersect an array of items with the input data. + * + * @param array|mixed $keys + * @return array + */ + public function intersect($keys) + { + return array_filter($this->only($keys)); + } + /** * Retrieve a query string item from the request. *