MessageBag
Implements
Properties
$messages array
All of the registered messages.
$format string
Default format for message output.
Methods
__construct ( array $messages ) : void
Create a new message bag instance.
Parameters
- $messages array
keys ( ) : array
Get the keys present in the message bag.
add ( $key , $message ) : $this
Add a message to the message bag.
Parameters
- $key string
- $message string
addIf ( $boolean , $key , $message ) : $this
Add a message to the message bag if the given conditional is "true".
Parameters
- $boolean bool
- $key string
- $message string
isUnique ( $key , $message ) : bool
Determine if a key and message combination already exists.
Parameters
- $key string
- $message string
merge ( $messages ) : $this
Merge a new array of messages into the message bag.
Parameters
- $messages MessageProvider |array
has ( $key ) : bool
Determine if messages exist for all of the given keys.
Parameters
- $key array|string|null
hasAny ( $keys ) : bool
Determine if messages exist for any of the given keys.
Parameters
- $keys array|string|null
first ( $key , $format ) : string
Get the first message from the message bag for a given key.
Parameters
- $key string|null
- $format string|null
get ( $key , $format ) : array
Get all of the messages from the message bag for a given key.
Parameters
- $key string
- $format string|null
getMessagesForWildcardKey ( $key , $format ) : array
Get the messages for a wildcard key.
Parameters
- $key string
- $format string|null
all ( $format ) : array
Get all of the messages for every key in the message bag.
Parameters
- $format string|null
unique ( $format ) : array
Get all of the unique messages for every key in the message bag.
Parameters
- $format string|null
forget ( $key ) : $this
Remove a message from the message bag.
Parameters
- $key string
transform ( $messages , $format , $messageKey ) : array
Format an array of messages.
Parameters
- $messages array
- $format string
- $messageKey string
checkFormat ( $format ) : string
Get the appropriate format based on the given format.
Parameters
- $format string
messages ( ) : array
Get the raw messages in the message bag.
getMessages ( ) : array
Get the raw messages in the message bag.
getFormat ( ) : string
Get the default message format.
isEmpty ( ) : bool
Determine if the message bag has any messages.
isNotEmpty ( ) : bool
Determine if the message bag has any messages.
any ( ) : bool
Determine if the message bag has any messages.
count ( ) : int
Get the number of messages in the message bag.
toArray ( ) : array
Get the instance as an array.
jsonSerialize ( ) : array
Convert the object into something JSON serializable.
toJson ( $options ) : string
Convert the object to its JSON representation.
Parameters
- $options int
__toString ( ) : string
Convert the message bag to its string representation.