By John Koster
The isEmpty
method is the logical opposite of the any
method. It returns a boolean value indicating if the message bag is empty (having no messages). It returns true
if the message bag is empty; it returns false
if the message bag contains messages.
#Signature
The signature of the isEmpty
method is:
1public function isEmpty();
#Example Use
The following examples demonstrate the basic usage of the isEmpty
method:
1use Illuminate\Support\MessageBag;
2
3// Create a new MessageBag instance.
4$messageBag = new MessageBag;
5
6// true
7$isEmpty = $messageBag->isEmpty();
8
9$messageBag->addMessage('first', 'The first message');
10
11// false
12$isEmpty = $messageBag->isEmpty();
∎