How to add value in the second/child layer of an array

I’m trying to add a value media_type to every child of the array. The code I’m using is: while($row = $result->fetch_assoc()) { $url = "example"; $path = $this->get_url($url); $popular = ['media_type' => $row["type"],$path]; } Here’s an example of the array: . This content in the array is from themoviedb API. And is opensource. Answers: Thank … Read more

How to use in_array / array_push to get similar posts to a custom post?

I’m using array_push to collect posts that are the same tags to a custom post. I would like to collect unique posts, so I’m using in_array to check id of a post. It gives me errors like Object of class App\Models\Post could not be converted to int. So, how can check the id of post in array list? Is there another way in laravel without using array?