Hello @kartik,
If you have a collection you can use push or put method.
Example with put:
$collection = collect(['product_id' => 1, 'name' => 'Desk']);
$collection->put('test', 'test');
$collection->all();
The output will be:
['product_id' => 1, 'name' => 'Desk', 'test' => 'test']
Example with push:
$collection = collect([1, 2, 3, 4]);
$collection->push(5);
$collection->all();
Output:
[1, 2, 3, 4, 5]