Let just say i have this [{"id":21},{"id":22}]
array coming up from this :
$schedules = [];
foreach ($routes as $route) {
$schedules[] =Schedule::select('id')
->whereIn('route_id', $route)
->latest()
->first();
}
So, i want to extract the value from it like this [21,22]
, so i did it like this:
$values = $schedules->pluck('id')->toArray();
this showing this error
Call to a member function pluck() on array