Laravel Helpers: Arr and Data
January 16, 2026
•
1 min read
•
25 views
Table of Contents
Array helpers:
Arr Helper
Arr::get($array, 'user.name', 'default');
Arr::set($array, 'user.name', 'John');
Arr::has($array, 'user.name');
Arr Methods
Arr::first($array, fn($v) => $v > 10);
Arr::last($array);
Arr::pluck($array, 'name');
Arr::only($array, ['id', 'name']);
Data Helper
$value = data_get($data, 'user.posts.*.title');
data_set($data, 'user.name', 'John');
data_fill($data, 'user.name', 'Default');
Dot Notation
$flat = Arr::dot($array);
$nested = Arr::undot($flat);
Related Posts
Laravel Sanctum API Authentication Complete Guide
Build secure API authentication with Laravel Sanctum for SPAs and mobile apps.
Laravel Rate Limiting: Protect Your Application
Implement rate limiting to protect your Laravel application from abuse.
Laravel Blade Components: Build Reusable UI
Create powerful reusable components with Laravel Blade.
Comments (0)
No comments yet. Be the first to comment!