Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. AuthController:
  2.  
  3. protected function validator(array $data)
  4. {
  5.  
  6. $accountType = AccountType::find($data['account_type_id']);
  7.  
  8.  
  9. if($accountType->name === "employer"){
  10. return Validator::make($data, [
  11. //employer validation
  12. ]);
  13. }else{
  14. return Validator::make($data, [
  15. //candidate validation
  16. ...
  17. ]);
  18. }
  19.  
  20. }
  21.  
  22. /**
  23. * Create a new user instance after a valid registration.
  24. *
  25. * @param array $data
  26. * @return User
  27. */
  28. protected function create(array $data)
  29. {
  30.  
  31. // Check type of account
  32. $accountType = AccountType::find($data['account_type_id']);
  33.  
  34.  
  35. if($accountType->name === "employer"){
  36.  
  37. //employer create
  38.  
  39.  
  40. }else{
  41.  
  42. //Candidate user create
  43.  
  44. }
  45.  
  46.  
  47. return $user;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement