Last active
November 25, 2015 22:19
-
-
Save hannesvdvreken/0407b328712e4396d2e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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