Skip to content

Instantly share code, notes, and snippets.

@hannesvdvreken
Last active November 25, 2015 22:19
Show Gist options
  • Save hannesvdvreken/0407b328712e4396d2e5 to your computer and use it in GitHub Desktop.
Save hannesvdvreken/0407b328712e4396d2e5 to your computer and use it in GitHub Desktop.
class UserExporter
{
use CsvWriter;
public function __construct(User $users, UserTransformer $transformer)
{
$this->setup();
$this->setTransformer($transformer);
$this->users = $users;
}
public function getFile()
{
$this->users->chunk(100, function ($users) {
$this->writer->insertAll($users);
});
return $this->file;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment