title: Reading excel file and uploading to database Laravel 5
body: <p>I have this project where I should be able to upload an excel file and read the contents then upload the information to the database. So I decided to use a library to help me out which turns to be <a href="https://github.com/Maatwebsite/Laravel-Excel">Maatwebsite/Laravel-Excel</a></p>
  
  <p>But I tried reading the documentation <a href="http://www.maatwebsite.nl/laravel-excel/docs/import">http://www.maatwebsite.nl/laravel-excel/docs/import</a> but I can't seem to find the one that I need.</p>
  
  <p>For example in my excel file in the first row <code>John</code>, <code>Kennedy</code>, <code>Male</code>
  which in my database corrensponds <code>First Name</code>, <code>Last Name</code>, <code>Gender</code>. 
  How can I read it and upload? Can someone help me? </p>
  
  <p>Thanks!</p>
  
  <p>My code as of now</p>
  
  <pre><code>public function postUploadCsv()
  {
      $rules = array(
          'file' =&gt; 'required',
          'num_records' =&gt; 'required',
      );
  
      $validator = Validator::make(Input::all(), $rules);
      // process the form
      if ($validator-&gt;fails()) 
      {
          return Redirect::to('customer-upload')-&gt;withErrors($validator);
      }
      else 
      {
          $file = Input::file('file');
          dd($file);
          exit();
      } 
  }
  </code></pre>