Laravel's Collections should help you out here: https://laravel.com/docs/5.8/collections
Jun 28, 2019
2
Level 5
How to remove duplicate data from array
Hi, i have 3 queries and i used array_push() to push all three result in array for example:
$data = [ ];
$q1=Model::get()
array_push($data,$q1);
$q2=Model::get();
array_push($data,$q2);
$q3=Model::get();
array_push($data,$q3);
AND return $data gives following result
[
[
{
//data
]
]
I used array_unique , but its not working. i can't filter array. i can't remove duplicate data in array. Please help me. Thanks
Please or to participate in this conversation.