title: Storing data in database using laravel queue
body: <p>I am trying to store data in database by using laravel queue.  I want to show user a quick message that "your file is being imported" and want to store data using queue. I have used database as QUEUE_DRIVER in env file. When I try to store data it creates entry in jobs table but doesn't store anything in demo_tbl.    </p>
  
  <p>Here is what I have done so far -<br>
  Controller    </p>
  
  <pre><code>public function import(Request $request)
  {
      Excel::filter('chunk')-&gt;load($request-&gt;file('import_file')-&gt;getRealPath())-&gt;chunk(250, function($reader)
      {
          $this-&gt;dispatch(new ImportDistributor($reader-&gt;toArray()));
      });
  
      dd('your file is being imported. we will inform you once it is done.');
  }
  </code></pre>
  
  <p>Job -    </p>
  
  <pre><code>&lt;?php
  namespace App\Jobs;
  
  use Illuminate\Bus\Queueable;
  use Illuminate\Queue\SerializesModels;
  use Illuminate\Queue\InteractsWithQueue;
  use Illuminate\Contracts\Queue\ShouldQueue;
  use Illuminate\Foundation\Bus\Dispatchable;
  
  use App\Model\DemoTableModel;
  
  use DB;
  
  class ImportDistributor implements ShouldQueue
  {
      use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  
      /**
       * Create a new job instance.
       *
       * @return void
       */
     protected $data;
  
      public function __construct(array $request)
      {
          $this-&gt;data = $request;
      }
  
      public function handle()
      {
          if(isset($this-&gt;data) &amp;&amp; !empty($this-&gt;data))
          {
              foreach($this-&gt;data as $val)
              {
                  DemoTableModel::insert($val);
              }
          }
      }
  }    
  </code></pre>
  
  <p>Model    </p>
  
  <pre><code>&lt;?php
  
  namespace App\Model;
  
  use Illuminate\Database\Eloquent\Model;
  
  class DemoTableModel extends Model
  {
      protected $table    = 'demo_tbl';
      protected $fillable = [
                                'name', 
                                'city'
                            ];
  }
  </code></pre>
  
  <p>Any help would be appreciated.<br>
  Thanks.</p>