How to flatten a collection with items of array in Laravel
I need a result of an array that is flattenened like this: $result = ["1", "2", "3", "4", "5", "6", "7"]; I have a DB result of this query: $articles = DB::table(‘articles’) ->where(‘is_published’, ‘true’) ->get() ->pluck(‘category’); When I do this with this result: $unflattened_array = $articles->toArray(); dd($unflattened_array); The result looks like this: And when I… Read More How to flatten a collection with items of array in Laravel