Search

Laravel MessageBag Public API: getFormat

November 29, 2016 —John Koster

The getFormat is the logical opposite of the setFormat method. It simply returns the current format that is being used by the MessageBag instance.

1<?php
2 
3use Illuminate\Support\MessageBag;
4 
5// Create a new MessageBag instance.
6$messageBag = new MessageBag;
7 
8// :message
9$format = $messageBag->getFormat();
10 
11// Change the format.
12$messageBag->setFormat('<li>:message</li>');
13 
14// <li>:message</li>
15$format = $messageBag->getFormat();
16 
17// Reset the format.
18$messageBag->setFormat();
19 
20// :message
21$format = $messageBag->getFormat();

#Continue Reading

This article is the start of a mini-series about Laravel's ErrorMessageBag component. Click through the rest of the articles to continue reading:

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.