Advertisement
Guest User

Untitled

a guest
Oct 18th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. $data = $request->all();
  2.  
  3. if( $data ) {
  4. $user = new User;
  5. $user->nome = $data['name'];
  6. $user->email = $data['email'];
  7. $user->permission = 'anunciante';
  8. $user->password= bcrypt( $data['password']);
  9.  
  10. $anunciante = new Anunciante;
  11. $anunciante->nomeFantasia = $data['name'];
  12. $anunciante->razaoSocial = $data['razao'];
  13. $anunciante->cnpj = $data['CNPJ'];
  14. $anunciante->email = $data['email'];
  15. $anunciante->telefone = $data['telefone'];
  16. $anunciante->password= bcrypt( $data['password']);
  17.  
  18. $auth = [
  19. 'email' => $data['email'],
  20. 'password' => $data['password']
  21. ];
  22. if( Auth::attempt($auth) ) {
  23. return redirect('anunciante/home');
  24. } else {
  25. return redirect('anunciante/login');
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement