Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Http\Controllers\Auth;
  4.  
  5. use App\User;
  6. use App\Http\Controllers\Controller;
  7. use Illuminate\Support\Facades\Hash;
  8. use Illuminate\Support\Facades\Validator;
  9. use Illuminate\Foundation\Auth\RegistersUsers;
  10.  
  11. class RegisterController extends Controller
  12. {
  13. /*
  14. |--------------------------------------------------------------------------
  15. | Register Controller
  16. |--------------------------------------------------------------------------
  17. |
  18. | This controller handles the registration of new users as well as their
  19. | validation and creation. By default this controller uses a trait to
  20. | provide this functionality without requiring any additional code.
  21. |
  22. */
  23.  
  24. use RegistersUsers;
  25.  
  26. /**
  27. * Where to redirect users after registration.
  28. *
  29. * @var string
  30. */
  31. protected $redirectTo = '/home';
  32.  
  33. /**
  34. * Create a new controller instance.
  35. *
  36. * @return void
  37. */
  38. public function __construct()
  39. {
  40. $this->middleware('guest');
  41. }
  42.  
  43. /**
  44. * Get a validator for an incoming registration request.
  45. *
  46. * @param array $data
  47. * @return \Illuminate\Contracts\Validation\Validator
  48. */
  49. protected function validator(array $data)
  50. {
  51. return Validator::make($data, [
  52. 'name' => 'required|string|max:255',
  53. 'email' => 'required|string|max:255|unique:users',
  54. 'password' => 'required|string|min:1|confirmed',
  55. ]);
  56. }
  57.  
  58.  
  59. /**
  60. * Create a new user instance after a valid registration.
  61. *
  62. * @param array $data
  63. * @return \App\User
  64. */
  65. protected function create(array $data)
  66. {
  67. return User::create([
  68. 'user_fname' => $data['user_fname'],
  69. 'user_email' => $data['user_email'],
  70. 'user_password' => Hash::make($data['user_password']),
  71. ]);
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement