-
-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f312c57
commit db0c7fa
Showing
8 changed files
with
435 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ | |
/composer.lock | ||
.phpunit.result.cache | ||
.vs/ | ||
arquivos/*.txt | ||
exemplos/arquivos/*.txt | ||
exemplos/teste.php |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
* | ||
!.gitignore | ||
!*.ret | ||
!*.ret | ||
!template.blade.php |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
</head> | ||
<body> | ||
<img src="{{ $logo }}"/> | ||
<h1>{{ $empresa }}</h1></body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
require 'autoload.php'; | ||
$beneficiario = new \Eduardokum\LaravelBoleto\Pessoa([ | ||
'nome' => 'ACME', | ||
'endereco' => 'Rua um, 123', | ||
'cep' => '99999-999', | ||
'uf' => 'UF', | ||
'cidade' => 'CIDADE', | ||
'documento' => '99.999.999/9999-99', | ||
]); | ||
|
||
$pagador = new \Eduardokum\LaravelBoleto\Pessoa([ | ||
'nome' => 'Cliente', | ||
'endereco' => 'Rua um, 123', | ||
'bairro' => 'Bairro', | ||
'cep' => '99999-999', | ||
'uf' => 'UF', | ||
'cidade' => 'CIDADE', | ||
'documento' => '999.999.999-99', | ||
]); | ||
|
||
$boleto = new Eduardokum\LaravelBoleto\Boleto\Banco\Bancoob([ | ||
'logo' => realpath(__DIR__ . '/../logos/') . DIRECTORY_SEPARATOR . '756.png', | ||
'dataVencimento' => new \Carbon\Carbon(), | ||
'valor' => 100, | ||
'multa' => false, | ||
'juros' => false, | ||
'numero' => 1, | ||
'numeroDocumento' => 1, | ||
'pagador' => $pagador, | ||
'beneficiario' => $beneficiario, | ||
'carteira' => 1, | ||
'agencia' => 1111, | ||
'convenio' => 123123, | ||
'conta' => 22222, | ||
'descricaoDemonstrativo' => ['demonstrativo 1', 'demonstrativo 2', 'demonstrativo 3'], | ||
'instrucoes' => ['instrucao 1', 'instrucao 2', 'instrucao 3'], | ||
'aceite' => 'S', | ||
'especieDoc' => 'DM', | ||
]); | ||
|
||
$configsCasoNaoTenhaUmMailerConfiguradoNoSeuLaravel = [ | ||
'scheme' => 'smtp', | ||
'port' => 'porta', | ||
'host' => 'smtp.host.com', | ||
'username' => 'usuario', | ||
'password' => 'senha', | ||
'from' => ['address' => 'empresa@empresa.com', 'name' => 'Empresa'], | ||
]; | ||
|
||
$mail = new Eduardokum\LaravelBoleto\Boleto\Mail($boleto, 'email@cliente.com', $configsCasoNaoTenhaUmMailerConfiguradoNoSeuLaravel); | ||
|
||
$data = [ | ||
'empresa' => 'Nome da empresa', | ||
'logo' => 'full/path/logo.png', | ||
]; | ||
|
||
$mail->send(['arquivos/template.blade.php', $data], 'assunto'); | ||
|
||
$mail->send( | ||
[ | ||
'<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"></head><body><img src="{{ $logo }}"/><h1>{{ $empresa }}</h1></body></html>', | ||
$data, | ||
], | ||
'assunto' | ||
); | ||
|
||
$mail->send( | ||
'Email simples sem template', | ||
'assunto' | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Eduardokum\LaravelBoleto\Boleto; | ||
|
||
use Exception; | ||
use Illuminate\Mail\Mailer; | ||
use Illuminate\Foundation\Application; | ||
use Psr\Container\NotFoundExceptionInterface; | ||
use Psr\Container\ContainerExceptionInterface; | ||
use Eduardokum\LaravelMailAutoEmbed\Listeners\SymfonyEmbedImages; | ||
use Eduardokum\LaravelMailAutoEmbed\Contracts\Listeners\EmbedImages; | ||
|
||
class LaravelBoletoMailer extends Mailer | ||
{ | ||
/** | ||
* @param $message | ||
* @param $data | ||
* @return bool | ||
* @throws ContainerExceptionInterface | ||
* @throws NotFoundExceptionInterface | ||
*/ | ||
protected function shouldSendMessage($message, $data = []) | ||
{ | ||
if (self::isLaravel9Plus() && ! app()->bound(EmbedImages::class)) { | ||
try { | ||
(new SymfonyEmbedImages(config()->get('mail-auto-embed')))->handle($message); | ||
} | ||
catch (Exception $e){} | ||
} | ||
|
||
return parent::shouldSendMessage($message, $data); | ||
} | ||
|
||
/** | ||
* @return bool|int | ||
*/ | ||
public static function isLaravel9Plus() | ||
{ | ||
return version_compare(Application::VERSION, '9.0.0', '>='); | ||
} | ||
} |
Oops, something went wrong.