$collection = collect([1, 2, 3]);
$collection->when(true, function ($collection) {
return $collection->push(4);
});
$collection->all();
// [1, 2, 3, 4]
$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);
$value = $collection->get('name');
// taylor
collect([1, 2, 3])->all();
// [1, 2, 3]
$users = $users->only([1, 2, 3]);
get(); //return collection
first(); //return object