lundi 19 octobre 2020

How to add chunk to a config file in laravel?

I have to add the data from the table to the API.

Say for ex, if I have 1000 records in my table how will I add the datas using chunks. From the config file I should use the chunk size.

My code looks something like this and I want to convert the array to a string so I used implode function.

public function addToList($data)
    {
        $numbers = [];

        foreach ($data as $item)
        {
            $numbers[] = $item->value . ',id:' . $item->id . ',email:' . $item->email . ',name:' . $item->name;
        }

        $numbers = implode('|', $numbers);
}

How will I add chunks to the above code ?

How to fetch the chunk information from the config file and to implement it in the code.

$data is the data from the table.

Could someone please help me? Thank you.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/37l54cC
via IFTTT

Aucun commentaire:

Enregistrer un commentaire