Laravel bulk insert optimization
implode works


        $insertString = '';
        foreach ($ch as $element) {
            $insertString .= '(' . $element . '), ';
        }

        $insertString = rtrim($insertString, ", ");



You can replace this section of code with just something like 

        $insertString = '(' . implode('), (', $ch-&gt;all()) . ')';


This is shorter with fewer failure points.  And of course, it avoids having to trim off the extra comma at the end.  

Bound parameters

But actually, it would be better to replace it with something like 

        $insertString = implode(', ', array_fill(0, $ch-&gt;count(), '(?, ?)'));


and then pass the values to DB::insert as an array.  I'd write more of the code for this, but I'm not sure exactly how the Laravel Collection objects work.  

Naming

Data is already plural (the singular is datum).  There is no datas.  

I'd prefer $chunk to $ch.