mercredi 2 août 2017

Laravel collection update array values by key

I try to manipulate a laravel collection what I've been creating and I want to update the array values on key

//This is my laravel collection
       $data = collect();


        if(!empty($sp)) {
            $k = key($sp);

            if($sp[$k]->week === $w ) {

                $us = $data->get($w);

                $t = $us['supplies'];
//I push values on exiting array where value is null
                $t[$sp[$k]->skillset] += $sp[$k]->slots_count;
//here if I var_dump I see the value
                $data->update();
            }
        }

How do I update laravel collection array values?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire