Commit 42edf70b authored by Colin Viebrock's avatar Colin Viebrock

Make the key optional for has() too ... like a "has_any()" method

Signed-off-by: 's avatarColin Viebrock <colin@viebrock.ca>
parent 968808f8
...@@ -52,10 +52,18 @@ class Messages { ...@@ -52,10 +52,18 @@ class Messages {
/** /**
* Determine if messages exist for a given key. * Determine if messages exist for a given key.
* *
* <code>
* // Is there a message for the e-mail attribute
* return $messages->has('email');
*
* // Is there a message for the any attribute
* echo $messages->has();
* </code>
*
* @param string $key * @param string $key
* @return bool * @return bool
*/ */
public function has($key) public function has($key = null)
{ {
return $this->first($key) !== ''; return $this->first($key) !== '';
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment