MessageBag
interface MessageBag implements Arrayable (View source)
Methods
array | toArray() Get the instance as an array. | from Arrayable |
array | keys() Get the keys present in the message bag. | |
$this | add(string $key, string $message) Add a message to the bag. | |
$this | merge(MessageProvider|array $messages) Merge a new array of messages into the bag. | |
bool | has(string|array $key) Determine if messages exist for a given key. | |
string | first(string $key = null, string $format = null) Get the first message from the bag for a given key. | |
array | get(string $key, string $format = null) Get all of the messages from the bag for a given key. | |
array | all(string $format = null) Get all of the messages for every key in the bag. | |
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. | |
int | count() Get the number of messages in the container. |
Details
array toArray()
Get the instance as an array.
array keys()
Get the keys present in the message bag.
$this add(string $key, string $message)
Add a message to the bag.
$this merge(MessageProvider|array $messages)
Merge a new array of messages into the bag.
bool has(string|array $key)
Determine if messages exist for a given key.
string first(string $key = null, string $format = null)
Get the first message from the bag for a given key.
array get(string $key, string $format = null)
Get all of the messages from the bag for a given key.
array all(string $format = null)
Get all of the messages for every key in the bag.
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.
int count()
Get the number of messages in the container.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.4/Illuminate/Contracts/Support/MessageBag.html