Search

Showing 7 of 1,216 result(s)

/blog/2018/04/21/laravel-5-message-bags-converting-the-message-bag-to-json-with-tojson

The toJson method will return a JSON encoded version of the data stored within the message bag instance. It internally does this by returning a call to PHP's json_encode function, passing in any $options that were supplied. Like the json_encode...

/blog/2018/04/21/laravel-5-message-bags-converting-the-message-bag-to-something-json-serializeable-with-jsonserialize

The jsonSeralize method internally returns the value of the toArray method. This method exists to implement PHP's JsonSerializable interface, which allows developers to customize how a class is represented when using the json_encode function.The...

/blog/2018/04/21/laravel-5-message-bags-determining-if-there-are-any-messages-with-any

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 .The signature of the any method is: public function any();The...

/blog/2018/04/21/laravel-5-message-bags-getting-all-of-the-message-keys-with-keys

The keys method is used to retrieve all of keys stored inside the MessageBag instance.The signature of the keys method is: public function keys();The following code example demonstrate the usage of the keys method: After the above code has...

/blog/2018/04/21/laravel-5-message-bags-getting-an-array-of-messages-with-getmessages

The getMessages method is used to return all of the messages stored within the MessageBag instance. The getMessages method will always return an array. If there are no messages in the message bag, an empty array will be returned.The signature of...

/blog/2018/04/21/laravel-5-message-bags-getting-the-current-message-format-with-getformat

The getFormat is the logical opposite of the setFormat method. It simply returns the current format that is being used by the MessageBag instance.The signature of the getFormat method is: public function getFormat();The following examples...

/blog/2018/04/21/laravel-5-message-bags-merging-additional-messages-with-merge

The merge method is used to combine, or merge , the contents of the MessageBag instance with the provided $messages . The $messages can be any valid array or an object instance that implements the "Illuminate\Contracts\Support\MessageProvider"...