Category Archives: Laravel

Laravel Tutorials

Laravel Arr last() function Example

Laravel Arr last() function Example

In this article, I’ll show you how to use laravel Arr last() function with example. We will show example of Arr last() function in laravel. In this tutorial, we will use Arr last() function to return last element of an array passing a given truth test.

Laravel Arr::last method

The Arr::last method returns the last element of an array passing a given truth test.

Example:-

Output:-

Laravel Arr flatten() function Example

Laravel Arr flatten() function Example

In this article, I’ll show you how to use laravel Arr flatten() function with example. We will show example of Arr flatten() function in laravel. In this tutorial, we will use Arr flatten() function to flatten a multi-dimensional array into a single level array.

Laravel Arr::flatten method

The Arr::flatten method flattens a multi-dimensional array into a single level array.

Example:-

Output:-

Laravel Arr get() function Example

Laravel Arr get() function Example

In this article, I’ll show you how to use laravel Arr get() function with example. We will show example of Arr get() function in laravel. In this tutorial, we will use Arr get() function to get a value from a deeply nested array using “dot” notation.

Laravel Arr::get method

The Arr::get method retrieves a value from a deeply nested array using “dot” notation.

Example:-

Output:-

Laravel Arr sort() function Example

Laravel Arr sort() function Example

In this article, I’ll show you how to use laravel Arr sort() function with example. We will show example of Arr sort() function in laravel. In this tutorial, we will use Arr sort() function to sort provided array by its values.

Laravel Arr::sort method

The Arr::sort method sorts an array by its values.

Example:-

Output:-

Laravel Arr prepend() function Example

Laravel Arr prepend() function Example

In this article, I’ll show you how to use laravel Arr prepend() function with example. We will show example of Arr prepend() function in laravel. In this tutorial, we will use Arr prepend() function to push an item onto the beginning of an array.

Laravel Arr::prepend method

The Arr::prepend method will push an item onto the beginning of an array.

Example:-

Output:-

Laravel Arr random() function Example

Laravel Arr random() function Example

In this article, I’ll show you how to use laravel Arr random() function with example. We will show example of Arr random() function in laravel. In this tutorial, we will use Arr random() function to  retrieve a random value from given array.

Laravel Arr::random method

The Arr::random method returns a random value from an array.

Example:-

Output:-

Laravel Arr wrap() function Example

Laravel Arr wrap() function Example

In this article, I’ll show you how to use laravel Arr wrap() function with example. We will show example of Arr wrap() function in laravel. In this tutorial, we will use Arr wrap() function to  convert string variable to array.

Laravel Arr::wrap method

The Arr::wrap method converts or wraps the given value in an array format. If the given value is already an array format it will be returned without modification.

Example:-

Output:-

Laravel Arr dot() function Example

Laravel Arr dot() function Example

In this article, I’ll show you how to use laravel Arr dot() function with example. We will show example of Arr dot() function in laravel. In this tutorial, we will use Arr dot() function to flatten a multi-dimensional array into a single level array using “dot” notation.

Laravel Arr::dot method

The Arr::dot method flattens a multi-dimensional array into a single level array using “dot” notation to indicate depth.

Example:-

Output:-

Laravel Arr has() function Example

Laravel Arr has() function Example

In this article, I’ll show you how to use laravel Arr has() function with example. We will show example of Arr has() function in laravel. In this tutorial, we will use Arr has() function to check whether a given item or items exists in an array using “dot”

Laravel Arr::has method

The Arr::has method checks whether a given item or items exists in an array using “dot” notation.

Example:-

Output:-

Laravel Arr where() function Example

Laravel Arr where() function Example

In this article, I’ll show you how to use laravel Arr where() function with example. We will show example of Arr where() function in laravel. In this tutorial, we will use Arr where() function to filter an array using the provided where Closure.

Laravel Arr::where method

The Arr::where method filters an array using the provided where Closure.

Example:-

Output:-

Laravel Arr hasAny() function Example

Laravel Arr hasAny() function Example

In this article, I’ll show you how to use laravel Arr hasAny() function with example. We will show example of Arr hasAny() function in laravel. In this tutorial, we will use Arr hasAny() function to check whether any item in a given set exists in an array using “dot” notation.

Laravel Arr::hasAny method

The Arr::hasAny method checks whether any item in a given set exists in an array using “dot” notation.

Example:-

Output:-

Laravel Google Translate Tutorial

In this article, I’ll show you how to use google translate package in laravel. It is easy to use and integrate google translate package in laravel.

.Laravel Google Translate is a Laravel package that is used to translate our files to other languages automatically using stichoza/google-translate-php or Google Translate API. Laravel Google Translate provides an artisan command to translate our localization files with the Google translation API.

Google Translate Installation In Laravel

Switch to your project directory and use the following artisan command to install Google Translate Package in your laravel application.

If you would like to use stichoza/google-translate-php you do not need an API key. If you would like to use Google Translate API, edit config/laravel_google_translate.php and add your Google Translate API key.

Now, run the following command to translate: