Guest User

Untitled

a guest
Dec 20th, 2017
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. MAIL_DRIVER=smtp
  2. MAIL_HOST=smtp.mailtrap.io
  3. MAIL_PORT=2525
  4. MAIL_USERNAME=291ac7fdcf52bb
  5. MAIL_PASSWORD=610b2e5e9782d3
  6.  
  7. <?php
  8.  
  9. namespace AppMail;
  10.  
  11. use IlluminateBusQueueable;
  12. use IlluminateMailMailable;
  13. use IlluminateQueueSerializesModels;
  14. use IlluminateContractsQueueShouldQueue;
  15.  
  16. class DadosManifestacaoMail extends Mailable
  17. {
  18. use Queueable, SerializesModels;
  19.  
  20. protected $inputs;
  21.  
  22. /**
  23. * Create a new message instance.
  24. *
  25. * @return void
  26. */
  27. public function __construct($inputs)
  28. {
  29. $this->inputs = $inputs;
  30. }
  31.  
  32. /**
  33. * Build the message.
  34. *
  35. * @return $this
  36. */
  37. public function build()
  38. {
  39. return $this->view('mails.dados');
  40. }
  41. }
  42.  
  43. <?php
  44.  
  45. namespace AppHttpControllers;
  46.  
  47. use IlluminateHttpRequest;
  48. use AppManifestacao;
  49. //use IlluminateSupportFacadesDB;
  50. use AppMailDadosManifestacaoMail;
  51.  
  52. class ManifestacaoController extends Controller
  53. {
  54. private $manifestacao;
  55.  
  56. public function __construct(Manifestacao $manifestacao)
  57. {
  58. $this->manifestacao = $manifestacao;
  59. }
  60.  
  61. /**
  62. * Store a newly created resource in storage.
  63. *
  64. * @param IlluminateHttpRequest $request
  65. * @return IlluminateHttpResponse
  66. */
  67. public function store(Request $request)
  68. {
  69.  
  70. //$nr = DB::table('tbmanifestacao')->max('nrmanifestacao');
  71. $nr = Manifestacao::max('nrmanifestacao');
  72.  
  73. $this->manifestacao->nrmanifestacao = $nr + 1;
  74. $this->manifestacao->dsbairro = $request->dsbairro;
  75. $this->manifestacao->dscomplemento = $request->dscomplemento;
  76. $this->manifestacao->dslocalidade = $request->dslocalidade;
  77. $this->manifestacao->dssenha = $request->dssenha;
  78. $this->manifestacao->eeemailusuario = $request->eeemailusuario;
  79. $this->manifestacao->enendereco = $request->enendereco;
  80. $this->manifestacao->nmpessoa = $request->nmpessoa;
  81. $this->manifestacao->nrcelular = $request->nrcelular;
  82. $this->manifestacao->nrcpfcnpj = $request->nrcpfcnpj;
  83. $this->manifestacao->nrendereco = $request->nrendereco;
  84. $this->manifestacao->nrtelefone = $request->nrtelefone;
  85. $this->manifestacao->latitude = $request->latitude;
  86. $this->manifestacao->longitude = $request->longitude;
  87.  
  88. $this->manifestacao->save();
  89.  
  90. Mail::to('vazag@c1oramn.com')->send(new DadosManifestacaoMail());
  91.  
  92. return response()->json([
  93. 'result' =>
  94. $this->manifestacao->nrmanifestacao
  95. ]);
  96. }
  97.  
  98. }
Add Comment
Please, Sign In to add comment