You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In most of the projects I do with Laravel, I always need this, which is a collection to convert all the arrays of an array into a comprehensive collection.
\Illuminate\Support\Collection::macro('recursive', function () {
return $this->map(function ($value) {
if (is_array($value) || is_object($value)) {
return collect($value)->recursive();
}
return $value;
});
});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
In most of the projects I do with Laravel, I always need this, which is a collection to convert all the arrays of an array into a comprehensive collection.
Usage is quite simple:
I'm currently doing this as follows: You'd better add this to your project to make working with Laravel easier.
Beta Was this translation helpful? Give feedback.
All reactions