Closed
Description
Creating a new instance of a MessageBag and then manually adding each message is tedious. Being able to pass messages in the constructor may be an alternative. For example, currently this needs to be done:
$messages = new MessageBag;
$messages->add('username', 'The username does not exist.');
$messages->add('password', 'Incorrect password.');
Instead, this may be better:
$messages = new MessageBag(array(
'username' => 'The username does not exist.',
'password' => 'Incorrect password.',
));
This would also need to support multiple errors for the same key. That would look something like:
$messages = new MessageBag(array(
'username' => 'The username does not exist.',
'password' => array(
'The password is required.',
'Incorrect password.',
),
));
Metadata
Metadata
Assignees
Labels
No labels