Search

Showing 7 of 587 result(s)

/blog/2018/02/20/laravel-5-string-translation-public-api#content-example-use

In the following examples, we will look at the various ways we can invoke the get method. We will start with simple translation line retrieval and gradually work through using the remaining parameters.

/blog/2018/02/20/laravel-5-string-translation-public-api#content-specifying-a-locale

By default, the get method will look for the translation lines using the locale specified as the default with the translation service. However, we can specify a locale by supplying an argument for the $locale parameter. For the following example,...

/blog/2018/02/20/laravel-5-string-translation-public-api#content-example-use-6

The following example demonstrates how to use the addLines method to add lines to the existing translator instance. We need to supply it a locale, but we will explore methods to do this dynamically based on the currently configured default locale....

/blog/2018/04/11/laravel-5-adding-a-new-element-to-the-beginning-of-an-array-with-prepend

The prepend helper method is used to push a new $value onto the beginning of an existing $array . It defines one optional parameter: $key . If an argument is supplied for $key , the new item will be given that key. Supply a value for $key if you...

/blog/2018/04/11/laravel-5-adding-or-setting-new-array-element-values-with-set#content-example-use

The set method also uses dot notation for its $key value. We will use the set function to create a simple array: Which would produce a familiar looking array: Overwriting the value of first_name is also easy to accomplish: The $testArray would now...

/blog/2018/04/11/laravel-5-adding-or-setting-new-array-element-values-with-set#content-replacing-the-array-with-a-completely-different-type

Since the set function will give the $array whatever the $value is when the $key is null , the original type of the variable can be changed completely. For example, setting the $array to null: Setting the $array to 100 :

/blog/2018/04/11/laravel-5-collapsing-a-multi-dimensional-array-to-a-single-level-with-collapse

The collapse helper method accepts an array as its only parameter. The given $array can be a single array, or a nested array. The method will then return a new array with the contents of all the nested arrays. Arrays that are collapsed can contain...