By John Koster
The any
method returns a boolean value indicating if the MessageBag
instance actually has any messages. The method returns true
if the instance has messages, otherwise it returns false
.
#Signature
The signature of the any
method is:
1public function any();
#Example Use
The following code examples demonstrate the usage of this fairly simple method:
1use Illuminate\Support\MessageBag;
2
3// Create a new MessageBag instance.
4$messageBag = new MessageBag;
5
6// false
7$hasAny = $messageBag->any();
8
9$messageBag->addMessage('first', 'The first message');
10
11// true
12$hasAny = $messageBag->any();
∎