Overview

Namespaces

  • Composer
    • Autoload
  • Illuminate
    • Support
      • Contracts
      • Facades
  • Laravella
    • Cart
      • Facades
  • None
  • PHP

Classes

  • ClassLoader
  • Collection
  • Fluent
  • Manager
  • MessageBag
  • NamespacedItemResolver
  • Pluralizer
  • SerializableClosure
  • ServiceProvider
  • Str
  • Overview
  • Namespace
  • Class
  • Tree

Class MessageBag

Illuminate\Support\MessageBag implements Illuminate\Support\Contracts\ArrayableInterface, Countable, Illuminate\Support\Contracts\JsonableInterface, Illuminate\Support\Contracts\MessageProviderInterface
Namespace: Illuminate\Support
Located at vendor/illuminate/support/Illuminate/Support/MessageBag.php
Methods summary
public
# __construct( array $messages = array() )

Create a new message bag instance.

Create a new message bag instance.

Parameters

$messages
array
$messages
public Illuminate\Support\MessageBag
# add( string $key, string $message )

Add a message to the bag.

Add a message to the bag.

Parameters

$key
string
$key
$message
string
$message

Returns

Illuminate\Support\MessageBag
public Illuminate\Support\MessageBag
# merge( array $messages )

Merge a new array of messages into the bag.

Merge a new array of messages into the bag.

Parameters

$messages
array
$messages

Returns

Illuminate\Support\MessageBag
protected boolean
# isUnique( 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.

Parameters

$key
string
$key

Returns

boolean
public string
# first( string $key = null, string $format = null )

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

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

Parameters

$key
string
$key
$format
string
$format

Returns

string
public array
# get( string $key, string $format = null )

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

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

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 bag.

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

Parameters

$format
string
$format

Returns

array
protected array
# transform( array $messages, string $format, string $messageKey )

Format an array of messages.

Format an array of messages.

Parameters

$messages
array
$messages
$format
string
$format
$messageKey
string
$messageKey

Returns

array
protected string
# checkFormat( string $format )

Get the appropriate format based on the given format.

Get the appropriate format based on the given format.

Parameters

$format
string
$format

Returns

string
public array
# getMessages( )

Get the raw messages in the container.

Get the raw messages in the container.

Returns

array
public Illuminate\Support\MessageBag
# getMessageBag( )

Get the messages for the instance.

Get the messages for the instance.

Returns

Illuminate\Support\MessageBag

Implementation of

Illuminate\Support\Contracts\MessageProviderInterface::getMessageBag()
public string
# getFormat( )

Get the default message format.

Get the default message format.

Returns

string
public Illuminate\Support\MessageBag
# setFormat( string $format = ':message' )

Set the default message format.

Set the default message format.

Parameters

$format
string
$format

Returns

Illuminate\Support\MessageBag
public boolean
# isEmpty( )

Determine if the message bag has any messages.

Determine if the message bag has any messages.

Returns

boolean
public boolean
# any( )

Determine if the message bag has any messages.

Determine if the message bag has any messages.

Returns

boolean
public integer
# count( )

Get the number of messages in the container.

Get the number of messages in the container.

Returns

integer

Implementation of

Countable::count()
public array
# toArray( )

Get the instance as an array.

Get the instance as an array.

Returns

array

Implementation of

Illuminate\Support\Contracts\ArrayableInterface::toArray()
public string
# toJson( integer $options = 0 )

Convert the object to its JSON representation.

Convert the object to its JSON representation.

Parameters

$options
integer
$options

Returns

string

Implementation of

Illuminate\Support\Contracts\JsonableInterface::toJson()
public string
# __toString( )

Convert the message bag to its string representation.

Convert the message bag to its string representation.

Returns

string
Properties summary
protected array $messages array()
#

All of the registered messages.

All of the registered messages.

protected string $format ':message'
#

Default format for message output.

Default format for message output.

cart API documentation generated by ApiGen 2.8.0