Methods summary
public
|
#
__construct( array $messages = array() )
Create a new Messages instance.
Create a new Messages instance.
Parameters
|
public
|
#
add( string $key, string $message )
Add a message to the collector.
Add a message to the collector.
$messages->add('email', 'The e-mail address is invalid.');
Parameters
- $key
string $key
- $message
string $message
|
protected
boolean
|
#
unique( string $key, string $message )
Determine if a key and message combination already exists.
Determine if a key and message combination already exists.
Parameters
- $key
string $key
- $message
string $message
Returns
boolean
|
public
boolean
|
#
has( string $key = null )
Determine if messages exist for a given key.
Determine if messages exist for a given key.
return $messages->has('email');
echo $messages->has();
Parameters
Returns
boolean
|
public
|
#
format( string $format = ':message' )
Set the default message format for output.
Set the default message format for output.
$messages->format('email', '<p>this is my :message</p>');
Parameters
|
public
string
|
#
first( string $key = null, string $format = null )
Get the first message from the container for a given key.
Get the first message from the container for a given key.
echo $messages->first();
echo $messages->first('email');
echo $messages->first('email', '<p>:message</p>');
Parameters
- $key
string $key
- $format
string $format
Returns
string
|
public
array
|
#
get( string $key, string $format = null )
Get all of the messages from the container for a given key.
Get all of the messages from the container for a given key.
echo $messages->get('email');
echo $messages->get('email', '<p>:message</p>');
Parameters
- $key
string $key
- $format
string $format
Returns
array
|
public
array
|
#
all( string $format = null )
Get all of the messages for every key in the container.
Get all of the messages for every key in the container.
$all = $messages->all();
$all = $messages->all('<p>:message</p>');
Parameters
Returns
array
|
protected
array
|
#
transform( array $messages, string $format )
Format an array of messages.
Format an array of messages.
Parameters
- $messages
array $messages
- $format
string $format
Returns
array
|