From 42edf70b10df5d62058d721cd02db8cf8dfdea93 Mon Sep 17 00:00:00 2001 From: Colin Viebrock Date: Thu, 8 Mar 2012 13:11:09 -0600 Subject: [PATCH] Make the key optional for has() too ... like a "has_any()" method Signed-off-by: Colin Viebrock --- laravel/messages.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/laravel/messages.php b/laravel/messages.php index 583a6e44..5ca75a6a 100644 --- a/laravel/messages.php +++ b/laravel/messages.php @@ -52,10 +52,18 @@ protected function unique($key, $message) /** * Determine if messages exist for a given key. * + * + * // Is there a message for the e-mail attribute + * return $messages->has('email'); + * + * // Is there a message for the any attribute + * echo $messages->has(); + * + * * @param string $key * @return bool */ - public function has($key) + public function has($key = null) { return $this->first($key) !== ''; }