Category Archives: Blog

Blog

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:

How to Increase Column Size using Laravel Migration

In this tutorial, we will learn how to change column length using laravel migration. It is easy to change column length using laravel migration. We will use laravel migration to change column length.

Create Table Migration

Change Column Length using Migration

Now, we will change title string length 50 to 100. We will use laravel migration to change column length. We will following composer package before creating change column length migration:

Install Composer Package

Change Column Length Migration

Laravel Custom Logout Example

In this article, we will learn to create laravel custom logout in your laravel project. It is easy to create laravel custom logout.

Create Laravel Custom Logout

Follow step by step laravel custom logout tutorial to create custom logout in laravel.

Create Route

Let’s open web.php file add the following route to it:

routes/web.php

Create a UserController Controller

Now, create a User Controller Controller name UserController. Use the below command to create controller.

Once the above command executed, it will create a resource controller file “UserController.php” in “app/Http/Controllers/” directory. Go to “UserController.php” and put the following code in it.

app/Http/Controllers/UserController.php

Create a User Blade File

In this step, we will create a view file named user.blade.php inside “resources/views/” directory and put the following code inside it –

resources/views/user.blade.php

Now we have created custom user logout functionality, restart the development server using following artisan command –

and visit the following URL in browser to see custom logout feature: