Documentation

MessageBag extends Arrayable

Table of Contents

add()  : $this
Add a message to the bag.
all()  : array<string|int, mixed>
Get all of the messages for every key in the bag.
count()  : int
Get the number of messages in the container.
first()  : string
Get the first message from the bag for a given key.
get()  : array<string|int, mixed>
Get all of the messages from the bag for a given key.
getFormat()  : string
Get the default message format.
getMessages()  : array<string|int, mixed>
Get the raw messages in the container.
has()  : bool
Determine if messages exist for a given key.
isEmpty()  : bool
Determine if the message bag has any messages.
isNotEmpty()  : bool
Determine if the message bag has any messages.
keys()  : array<string|int, mixed>
Get the keys present in the message bag.
merge()  : $this
Merge a new array of messages into the bag.
setFormat()  : $this
Set the default message format.
toArray()  : array<string|int, mixed>
Get the instance as an array.

Methods

add()

Add a message to the bag.

public add(string $key, string $message) : $this
Parameters
$key : string
$message : string
Return values
$this

all()

Get all of the messages for every key in the bag.

public all([string $format = null ]) : array<string|int, mixed>
Parameters
$format : string = null
Return values
array<string|int, mixed>

count()

Get the number of messages in the container.

public count() : int
Return values
int

first()

Get the first message from the bag for a given key.

public first([string $key = null ][, string $format = null ]) : string
Parameters
$key : string = null
$format : string = null
Return values
string

get()

Get all of the messages from the bag for a given key.

public get(string $key[, string $format = null ]) : array<string|int, mixed>
Parameters
$key : string
$format : string = null
Return values
array<string|int, mixed>

getFormat()

Get the default message format.

public getFormat() : string
Return values
string

getMessages()

Get the raw messages in the container.

public getMessages() : array<string|int, mixed>
Return values
array<string|int, mixed>

has()

Determine if messages exist for a given key.

public has(string|array<string|int, mixed> $key) : bool
Parameters
$key : string|array<string|int, mixed>
Return values
bool

isEmpty()

Determine if the message bag has any messages.

public isEmpty() : bool
Return values
bool

isNotEmpty()

Determine if the message bag has any messages.

public isNotEmpty() : bool
Return values
bool

keys()

Get the keys present in the message bag.

public keys() : array<string|int, mixed>
Return values
array<string|int, mixed>

merge()

Merge a new array of messages into the bag.

public merge(MessageProvider|array<string|int, mixed> $messages) : $this
Parameters
$messages : MessageProvider|array<string|int, mixed>
Return values
$this

setFormat()

Set the default message format.

public setFormat([string $format = ':message' ]) : $this
Parameters
$format : string = ':message'
Return values
$this

toArray()

Get the instance as an array.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

Search results