Search

Showing 7 of 1,216 result(s)

/blog/2018/04/21/laravel-5-fluent-api-the-public-api#content-example-use

Retrieving values from a Fluent instance: The $default value is evaluated using the value helper function, meaning that it can be the result of a function:

/blog/2018/04/21/laravel-5-fluent-api-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/2018/04/21/laravel-5-fluent-api-the-public-api#content-getting-keyvalue-data-associations-with-getattributes

The getAttributes method simply returns an array containing all key/value pairs, representing the underlying data contained within the Fluent instance.

/blog/2018/04/21/laravel-5-fluent-api-the-public-api#content-signature-1

The signature of the getAttributes method is: public function getAttributes();

/blog/2018/04/21/laravel-5-fluent-api-the-public-api#content-example-use-1

After the following code is executed: The $attributes variable would look have a value similar to the following:

/blog/2018/04/21/laravel-5-fluent-api-the-public-api#content-converting-the-data-object-to-an-array-with-toarray

The toArray method returns the exact same values as the getAttributes method; the results of the toArray method will return an array with all of the key/value pairs of the Fluent instance.

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.