1$users = User::all()->pluck('field_name');
2//for keys instead of [User::all()->pluck('id');] use
3$user_ids = User::all()->modelKeys();
1$array = [
2 ['developer' => ['id' => 1, 'name' => 'Taylor']],
3 ['developer' => ['id' => 2, 'name' => 'Abigail']],
4];
5
6$array = array_pluck($array, 'developer.name');
7
8// ['Taylor', 'Abigail'];
1$array = array_pluck($array, 'developer.name', 'developer.id');
2
3// [1 => 'Taylor', 2 => 'Abigail'];