laravel/laravel — pull request #379 by jasonlewis (2012-03-02 07:07:21+00:00)
Title: Allow no key in $messages->first()

Often I find I want to get the first message from the array of messages and not for a specific key. Quick fix to allow first message from all messages to be returned. Useful when used with the validator.

~~~~
if($validator->invalid())
{
throw new Exception($validator->errors->first()); // Throw exception with the first message in the array.
}
~~~~