In this post we will learn laravel helper function which easy to develop you laravel application.
Some time developer need to check the array can me merge or accessible or not.
So that laravel providing helper function, using the helper function you can check easily.
Arr::accessible this function will help you to check array can merge or array can accessible.
Follow the below example and apply in your application.
<?php
use Illuminate\Support\Facades\Route;
use Arr;
use Illuminate\Support\Collection;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/arr-accessible', function () {
$isAccessible = Arr::accessible(['a' => 1, 'b' => 2]);
// Output => true
$isAccessible = Arr::accessible(new Collection);
// Output => true
$isAccessible = Arr::accessible('abc');
// Output => false
$isAccessible = Arr::accessible(new stdClass);
// Output => false
});
Above are different example with Arr::accessible
We always thanks to you for reading our blogs.
Dharmesh Chauhan
(Swapinfoway Founder)Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us
Haresh Chauhan
(Co-Founder)We Are Also Recommending You :
- Laravel 12 REST API Tutorial for Beginners (Step-by-Step Guide 2026)
- Parent OrderBy From Many Child's Laravel Example
- Laravel 6 - Preview and Crop Image Before Upload using Ajax
- could not find driver (SQL: select count(*) as aggregate from "users" where "email" = admin@gmail.com)
- Laravel 9 Google Drive File Upload/Store Tutorial.
- How to Upload Multiple Images In Laravel 10
- Get Current Route Name Laravel
- How to get images from outside project directory laravel
- Laravel 9 REST API with Passport Authentication Tutorial
- Laravel 10 Breeze Integration Tutorial Example