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

Signed-off-by: Colin Viebrock <colin@viebrock.ca>
This commit is contained in:
Colin Viebrock 2012-03-08 13:11:09 -06:00
parent 968808f8d6
commit 42edf70b10
1 changed files with 9 additions and 1 deletions

View File

@ -52,10 +52,18 @@ protected function unique($key, $message)
/** /**
* 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) !== '';
} }