Search

Showing 7 of 1,216 result(s)

/blog/2016/11/21/laravel-fluent-part-two-the-public-api#content-fluent-and-closures

If we look at the following code example, one might be tempted to say that the value of $message would be Hello, world! , but that would be incorrect: However, that would be incorrect. It is important to remember that the Fluent object is an...

/blog/2016/11/21/laravel-fluent-part-two-the-public-api#content-getattributes

The getAttributes method simply returns an array containing all key/value pairs, representing the underlying data contained within the Fluent instance. After the following code is executed: The $attributes variable would look have a value similar...

/blog/2016/11/21/laravel-fluent-part-two-the-public-api#content-toarray

The toArray method returns the exact same values as the getAttributes method.

/blog/2016/11/21/laravel-fluent-part-two-the-public-api#content-jsonserialize

The jsonSerialize method internally returns a call to toArray . Because of this, toArray , jsonSerialize and getAttributes are all functionally equivalent. The jsonSerialize method exists to satisfy PHP's JsonSerializable interface, which allows...

/blog/2016/11/21/laravel-fluent-part-two-the-public-api#content-tojsonoptions--0

The toJson method will return a JSON encoded version of the data stored within the fluent 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/2016/11/21/laravel-fluent-part-two-the-public-api#content-tojson-and-deeply-nested-data-structures

The toJson method internally makes a call to PHP's json_encode function. Unlike json_encode , toJson does not provide a way to specify the depth (essentially how many arrays are nested inside of each other) to which data will be encoded, which is...

/blog/2016/11/29/an-introduction-to-laravel-collections

…apper around PHP's arrays. The Collection class has numerous methods for retrieving, setting and manipulating the data of the underlying array. Each Collection instance has an internal array which is used to store the actual collection...