Laravel Arr has() function Example

Mar 24, 2021



Laravel Arr has() function Example

Hi Guys,

In this blog, I will explain to you how to work laravel array has() function. We will show example of array has function to get array has element value in laravel. The Arr::has method checks whether a given item or items exists in an array using "dot" notation.

Here, I will give you a full example for simply Arr has() method in laravel as bellow.



namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Controllers\FileController;

use Illuminate\Support\Arr;

class HomeController extends Controller



* Show the application dashboard.


* @return \Illuminate\Contracts\Support\Renderable


public function index()


$array = ['car' => ['name' => 'Desk', 'price' => 100]];

$contains = Arr::has($array, '');

// true

$contains = Arr::has($array, ['car.price', '']);

// false






It Will help you...

#Laravel 8

#Laravel 7


#Laravel 6