class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, MessageBag, MessageProvider (View source)
protected array | $messages | All of the registered messages. | |
protected string | $format | Default format for message output. |
void | __construct(array $messages = []) Create a new message bag instance. | |
array | keys() Get the keys present in the message bag. | |
$this | add(string $key, string $message) Add a message to the message bag. | |
$this | addIf(bool $boolean, string $key, string $message) Add a message to the message bag if the given conditional is "true". | |
bool | isUnique(string $key, string $message) Determine if a key and message combination already exists. | |
$this | merge(MessageProvider|array $messages) Merge a new array of messages into the message bag. | |
bool | has(string|array $key) Determine if messages exist for all of the given keys. | |
bool | hasAny(array|string $keys = []) Determine if messages exist for any of the given keys. | |
string | first(string|null $key = null, string|null $format = null) Get the first message from the message bag for a given key. | |
array | get(string $key, string|null $format = null) Get all of the messages from the message bag for a given key. | |
array | getMessagesForWildcardKey(string $key, string|null $format) Get the messages for a wildcard key. | |
array | all(string|null $format = null) Get all of the messages for every key in the message bag. | |
array | unique(string|null $format = null) Get all of the unique messages for every key in the message bag. | |
array | transform(array $messages, string $format, string $messageKey) Format an array of messages. | |
string | checkFormat(string $format) Get the appropriate format based on the given format. | |
array | messages() Get the raw messages in the message bag. | |
array | getMessages() Get the raw messages in the message bag. | |
MessageBag | getMessageBag() Get the messages for the instance. | |
string | getFormat() Get the default message format. | |
$this | setFormat(string $format = ':message') Set the default message format. | |
bool | isEmpty() Determine if the message bag has any messages. | |
bool | isNotEmpty() Determine if the message bag has any messages. | |
bool | any() Determine if the message bag has any messages. | |
int | count() Get the number of messages in the message bag. | |
array | toArray() Get the instance as an array. | |
array | jsonSerialize() Convert the object into something JSON serializable. | |
string | toJson(int $options = 0) Convert the object to its JSON representation. | |
string | __toString() Convert the message bag to its string representation. |
Create a new message bag instance.
Get the keys present in the message bag.
Add a message to the message bag.
Add a message to the message bag if the given conditional is "true".
Determine if a key and message combination already exists.
Merge a new array of messages into the message bag.
Determine if messages exist for all of the given keys.
Determine if messages exist for any of the given keys.
Get the first message from the message bag for a given key.
Get all of the messages from the message bag for a given key.
Get the messages for a wildcard key.
Get all of the messages for every key in the message bag.
Get all of the unique messages for every key in the message bag.
Format an array of messages.
Get the appropriate format based on the given format.
Get the raw messages in the message bag.
Get the raw messages in the message bag.
Get the messages for the instance.
Get the default message format.
Set the default message format.
Determine if the message bag has any messages.
Determine if the message bag has any messages.
Determine if the message bag has any messages.
Get the number of messages in the message bag.
Get the instance as an array.
Convert the object into something JSON serializable.
Convert the object to its JSON representation.
Convert the message bag to its string representation.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Support/MessageBag.html