title: how to read .txt file which contains string to an array in laravel
body: <p>I would like to read .txt file contains string and convert it to an array, for better display i copy my string in .txt here.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Scan Date,Date,Time,PIN,Number,Name,Position,Department,Office,Verification,I/O,Workcode,SN,Machine
  
  02-05-2017 08:45:15,02-05-2017,8:45:15 AM,1,,MIRACLE,,,,1,1,0,13061016420031,Mesin 3
  02-05-2017 08:50:17,02-05-2017,8:50:17 AM,1,,MIRACLE,,,,1,2,0,13061016420031,Mesin 3
  02-05-2017 08:58:14,02-05-2017,8:58:14 AM,1,,MIRACLE,,,,1,1,0,13061016420031,Mesin 3
  02-05-2017 09:00:49,02-05-2017,9:00:49 AM,1,,MIRACLE,,,,1,2,0,13061016420031,Mesin 3
  02-05-2017 08:53:21,02-05-2017,8:53:21 AM,2,,LUNA,,,,1,1,0,13061016420031,Mesin 3
  02-05-2017 08:54:48,02-05-2017,8:54:48 AM,2,,LUNA,,,,1,2,0,13061016420031,Mesin 3
  02-05-2017 08:58:29,02-05-2017,8:58:29 AM,2,,LUNA,,,,1,0,0,13061016420031,Mesin 3
  02-05-2017 09:00:55,02-05-2017,9:00:55 AM,2,,LUNA,,,,1,2,0,13061016420031,Mesin 3
  03-04-2017 07:59:41,03-04-2017,7:59:41 AM,15,,,,,,1,0,0,13061016420031,Mesin 3
  05-04-2017 07:57:40,05-04-2017,7:57:40 AM,15,,,,,,1,0,0,13061016420031,Mesin 3
  07-04-2017 08:26:50,07-04-2017,8:26:50 AM,15,,,,,,1,1,0,13061016420031,Mesin 3
  10-04-2017 08:08:00,10-04-2017,8:08:00 AM,15,,,,,,1,0,0,13061016420031,Mesin 3
  03-04-2017 07:58:38,03-04-2017,7:58:38 AM,16,,,,,,1,1,0,13061016420031,Mesin 3
  03-04-2017 18:43:33,03-04-2017,6:43:33 PM,16,,,,,,1,2,0,13061016420031,Mesin 3
  04-04-2017 08:56:44,04-04-2017,8:56:44 AM,16,,,,,,1,0,0,13061016420031,Mesin 3
  04-04-2017 17:14:18,04-04-2017,5:14:18 PM,16,,,,,,1,2,0,13061016420031,Mesin 3
  05-04-2017 07:52:24,05-04-2017,7:52:24 AM,16,,,,,,1,1,0,13061016420031,Mesin 3
  05-04-2017 17:43:59,05-04-2017,5:43:59 PM,16,,,,,,1,2,0,13061016420031,Mesin 3
  06-04-2017 08:13:05,06-04-2017,8:13:05 AM,16,,,,,,1,1,0,13061016420031,Mesin 3
  06-04-2017 17:55:30,06-04-2017,5:55:30 PM,16,,,,,,1,2,0,13061016420031,Mesin 3
  07-04-2017 08:12:56,07-04-2017,8:12:56 AM,16,,,,,,1,1,0,13061016420031,Mesin 3
  07-04-2017 17:23:48,07-04-2017,5:23:48 PM,16,,,,,,1,2,0,13061016420031,Mesin 3
  10-04-2017 08:08:07,10-04-2017,8:08:07 AM,16,,,,,,1,1,0,13061016420031,Mesin 3
  10-04-2017 17:14:57,10-04-2017,5:14:57 PM,16,,,,,,1,2,0,13061016420031,Mesin 3
  11-04-2017 08:03:15,11-04-2017,8:03:15 AM,16,,,,,,1,1,0,13061016420031,Mesin 3
  11-04-2017 17:11:40,11-04-2017,5:11:40 PM,16,,,,,,1,2,0,13061016420031,Mesin 3
  12-04-2017 08:03:20,12-04-2017,8:03:20 AM,16,,,,,,1,1,0,13061016420031,Mesin 3
  12-04-2017 19:51:34,12-04-2017,7:51:34 PM,16,,,,,,1,2,0,13061016420031,Mesin 3
  12-04-2017 20:11:38,12-04-2017,8:11:38 PM,16,,,,,,1,2,0,13061016420031,Mesin 3
  17-04-2017 08:23:16,17-04-2017,8:23:16 AM,16,,,,,,1,1,0,13061016420031,Mesin 3
  17-04-2017 11:18:01,17-04-2017,11:18:01 AM,16,,,,,,1,1,0,13061016420031,Mesin 3
  17-04-2017 11:19:27,17-04-2017,11:19:27 AM,16,,,,,,1,0,0,13061016420031,Mesin 3
  18-04-2017 07:59:54,18-04-2017,7:59:54 AM,16,,,,,,1,1,0,13061016420031,Mesin 3
  20-04-2017 17:08:21,20-04-2017,5:08:21 PM,16,,,,,,1,2,0,13061016420031,Mesin 3
  21-04-2017 08:06:40,21-04-2017,8:06:40 AM,16,,,,,,1,1,0,13061016420031,Mesin 3
  21-04-2017 18:47:21,21-04-2017,6:47:21 PM,16,,,,,,1,2,0,13061016420031,Mesin 3
  25-04-2017 08:07:34,25-04-2017,8:07:34 AM,16,,,,,,1,1,0,13061016420031,Mesin 3</code></pre>
  </div>
  </div>
  </p>
  
  <p>i have successfully read it as a string but i am confuse how to make it an array and reading the string per line. i wanna to upload the string data to database. </p>
  
  <p>i already read the data as follows,</p>
  
  <pre><code>$input = Input::all();
  $file = File::get($input['uploadFile']);
  </code></pre>
  
  <p>and the result is string, <strong>the question</strong> is how to make it an array per line so that the result as desired :</p>
  
  <pre><code>[
   ["scandate" =&gt; '02-05-2017', "Date" =&gt; '02-05-2017', "Time" =&gt; '08:45:15', 
    "Number" =&gt; 1, "Name" =&gt; 'MIRACLE'],
   ["scandate" =&gt; '02-05-2017', "Date" =&gt; '02-05-2017', "Time" =&gt; '08:45:15', 
    "Number" =&gt; 1, "Name" =&gt; 'MIRACLE']
  ] etc
  </code></pre>
  
  <p>or at least like this</p>
  
  <pre><code>[
   ['02-05-2017 08:45:15','02-05-2017','8:45:15AM',1,'','MIRACLE','','','',1,1,0,13061016420031,'Mesin 3'],
   ['02-05-2017 08:45:15','02-05-2017','8:45:15AM',1,'','MIRACLE','','','',1,1,0,13061016420031,'Mesin 3'],
  
  ]
  </code></pre>