push key and value in laravel

42

public function index()
{
    $collection = collect(['id' => 1, 'name' => 'Hardik']);
  
    $collection->put('role', 'admin');
   
    $collection->all();
      
    dd($collection);
}

Comments

Submit
0 Comments