From b93a12209c38e807eb825a0c8e021da53db73ce2 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 28 Sep 2011 22:42:28 -0500 Subject: [PATCH] commenting validation messages. --- laravel/validation/messages.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/laravel/validation/messages.php b/laravel/validation/messages.php index 3c3f2689..d8e3d2e2 100644 --- a/laravel/validation/messages.php +++ b/laravel/validation/messages.php @@ -26,6 +26,11 @@ public function __construct($messages = array()) * * Duplicate messages will not be added. * + * + * // Add a message to the collector for the "email" attribute + * $messages->add('email', 'The e-mail address is invalid.'); + * + * * @param string $key * @param string $message * @return void @@ -52,6 +57,14 @@ public function has($key) /** * Get the first message for a given key. * + * + * // Get the first message for the e-mail attribute + * $email = $messages->first('email'); + * + * // Format the first message for the e-mail attribute + * $email = $messages->first('email', '

:message

'); + *
+ * * @param string $key * @param string $format * @return string @@ -64,6 +77,14 @@ public function first($key, $format = ':message') /** * Get all of the messages for a key. * + * + * // Get all of the messages for the e-mail attribute + * $email = $messages->get('email'); + * + * // Format all of the messages for the e-mail attribute + * $email = $messages->get('email', '

:message

'); + *
+ * * @param string $key * @param string $format * @return array @@ -78,6 +99,14 @@ public function get($key = null, $format = ':message') /** * Get all of the messages for every key. * + * + * // Get all of the messages in the collector + * $all = $messages->all(); + * + * // Format all of the messages in the collector + * $all = $messages->all('

:message

'); + *
+ * * @param string $format * @return array */