public function import(Request $request)
 {
     if (Request::hasFile('import-file')) {
         $file = Request::file('import-file');
         $subscribers = \League\Csv\Reader::createFromPath($file);
         $subscribers = $subscribers->fetchAssoc();
         if (count($subscribers) > 0) {
             $mailchimp = new MailChimp();
             foreach ($subscribers as $subscriber) {
                 // create the signup
                 $signup = new Signup();
                 $signup->fname = $subscriber['fname'];
                 $signup->lname = $subscriber['lname'];
                 $signup->email = $subscriber['email'];
                 $signup->zip = $subscriber['zip'];
                 $signup->ip = $_SERVER['REMOTE_ADDR'];
                 try {
                     // save the signup
                     $signup->save();
                     // add it to mailchimp
                     $mailchimp->addSubscriber(['email' => $signup->email, 'fname' => $signup->fname, 'lname' => $signup->lname, 'zip' => $signup->zip]);
                 } catch (\Exception $e) {
                 }
             }
             return redirect('admin/subscribers')->withSuccess('Subscribers import completed.');
         }
     } else {
         echo 'no file uploaded';
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(BetaSignupRequest $request)
 {
     // create a new signup
     $signup = new Signup();
     foreach ($this->fields as $field => $default) {
         $signup->{$field} = $request->get($field);
     }
     // set the ip of the person signing up
     $signup->ip = $_SERVER['REMOTE_ADDR'];
     $signup->save();
     // add to mailchimp mailing list
     $mailchimp = new MailChimp();
     $mailchimp->addSubscriber(['email' => $signup->email, 'fname' => $signup->fname, 'lname' => $signup->lname, 'zip' => $signup->zip]);
     // redirect to the thank you page
     return redirect('/signup/thankyou')->withSuccess("Thank you for signing up. We will inform you once we launch.");
 }