PHP von Objekten ausgewählt
$cats = [
0 => { 'id': 15 },
1 => { 'id': 18 },
2 => { 'id': 23 }
]
$idCats = array_column($cats, 'id');
patrick204nqh
$cats = [
0 => { 'id': 15 },
1 => { 'id': 18 },
2 => { 'id': 23 }
]
$idCats = array_column($cats, 'id');
$users = User::all()->pluck('field_name');
//for keys instead of [User::all()->pluck('id');] use
$user_ids = User::all()->modelKeys();
$array = [
['developer' => ['id' => 1, 'name' => 'Taylor']],
['developer' => ['id' => 2, 'name' => 'Abigail']],
];
$array = array_pluck($array, 'developer.name');
// ['Taylor', 'Abigail'];