Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. namespace App\Repositories;
  5.  
  6. use App\Mail\SendPasswordRecoveryMail;
  7. use App\Models\Usuario;
  8. use Illuminate\Support\Facades\Mail;
  9.  
  10.  
  11. class UsuarioRepository
  12. {
  13. public function recorveryPassword($login, $cpf, $email){
  14. $user = $this->findUserRecoveryPassword($login, $cpf, $email);
  15. if ($user != null){
  16. $this->sendRecoveryMail($user);
  17. return true;
  18. } else {
  19. flash()->error('Não foi encontrado usuário com os dados informados.');
  20. return false;
  21. }
  22. }
  23.  
  24. public function findUserRecoveryPassword($login, $cpf, $email){
  25. $user = Usuario::where('login', '=', $login)
  26. ->where('cpf', '=', $cpf)
  27. ->where('email', '=', $email)
  28. ->first();
  29. return $user;
  30. }
  31.  
  32. public function sendRecoveryMail($user)
  33. {
  34. Mail::send(new SendPasswordRecoveryMail($user));
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement