I am making a module which you upload records on a database from an excel file. Those are just phone numbers. So here's my code:
$file = Input::file('file');
Excel::load($file, function($reader) {
// Getting all results
$results = $reader->get()->toArray();
//var_dump($results);exit;
foreach ($results as $key => $value) {
$phone = new Phone();
$phone->msisdn = $value['msisdn'];
$phone->save();
}
});
I'm using https://github.com/Maatwebsite/Laravel-Excel to read the excel file. It works fine, 20,000 records uploads in 20mins I guess, is there a way to to it or upload it faster? I know that it depends also in the server but is there other factors? I'm using MySQL
Thanks