array:5 [
0 => array:1 [
"location_id" => 1
]
1 => array:1 [
"location_id" => 4
]
2 => array:1 [
"location_id" => 6
]
3 => array:1 [
"location_id" => 7
]
4 => array:1 [
"location_id" => 8
]
]
convert this into ["1","4","6","7","8",]
as used this ["1","4","6","7","8",]array in different query
4
Answers
You can use the laravel helper array flatten method: Read more about it from here: https://laravel.com/docs/9.x/helpers#method-array-flatten
Results:
You can use Laravel Collection
pluck
method to only return property which you want from each array item, and after that flatten the result array withflatten
Not as clean you might want but get the job done:
You can use the laravel helper array pluck method Read more about it from here: https://laravel.com/docs/9.x/helpers#method-array-pluck
Result