From c94ceec0ee5e9ed51039ddc6729afe07f726825a Mon Sep 17 00:00:00 2001 From: Jelle Breuer Date: Fri, 5 Aug 2016 17:12:31 +0200 Subject: [PATCH] Added makeHidden method --- src/Illuminate/Database/Eloquent/Model.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index 8e31c518ef8e..a1d1a98090bb 100755 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -2140,6 +2140,23 @@ public function makeVisible($attributes) return $this; } + /** + * Make the given, typically visible, attributes hidden. + * + * @param array|string $attributes + * @return $this + */ + public function makeHidden($attributes) + { + $this->visible = array_diff($this->visible, (array) $attributes); + + if (! empty($this->hidden)) { + $this->addHidden($attributes); + } + + return $this; + } + /** * Make the given, typically hidden, attributes visible. *