Created
October 24, 2016 22:35
-
-
Save ricardobarantini/4b0e03ad3d4221e3c254e0bf8e82bc39 to your computer and use it in GitHub Desktop.
Gerando lote de remessas com o package \Eduardokum\LaravelBoleto
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
<?php | |
/** | |
* Gera o arquivo de remessa. | |
* | |
* @var date $data_inicio | |
* @var date $data_termino | |
* @var int $bancos_id | |
* @return void | |
*/ | |
public function arquivo($data_inicio, $data_termino, $bancos_id) | |
{ | |
// Define os valores recebido por GET | |
$this->data_inicio = $data_inicio; | |
$this->data_termino = $data_termino; | |
$this->bancos_id = $bancos_id; | |
// Captura as parcelas | |
$parcelas = $this->listarParcelas(); | |
// Define o objeto | |
$remessa = new \Eduardokum\LaravelBoleto\Cnab\Remessa\Banco\Santander($this->dados_remessa()); | |
foreach ($parcelas as $parcela) { | |
// Monta o array com dados do boleto | |
$dados = $this->boleto($parcela->id); | |
// Define o boleto | |
$boleto = new \Eduardokum\LaravelBoleto\Boleto\Banco\Santander($dados); | |
// Adiciona o boleto na remessa | |
$remessa->addBoleto($boleto); | |
} | |
// Salva o arquivo da remessa na pasta storage/remessas | |
Storage::put('remessas/remessa.txt', $remessa->gerar()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment