How to get multiple dimensional array from single dimensional array in php/laravel? code example
Example 1: display data from two dimensional array in vew laravel
@foreach ($object as $foo)
@foreach ($foo as $name)
{{ $name }}
@endforeach
@endforeach`
Example 2: laravel return a single dimensional array
$catcount = 2;
$parents_ids = [];
for ($i = 0; $i < $catcount; $i++) {
$parents_ids[] = $userCategory[$i];
}
$subCats = Category::whereIn('parent_id', $parents_ids)->pluck('id');