Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. public function auth(array $options = [])
  2. {
  3. // Authentication Routes...
  4. $this->get('admin/login', 'AuthLoginController@showLoginForm')->name('login');
  5. $this->post('admin/login', 'AuthLoginController@login');
  6. $this->post('admin/logout', 'AuthLoginController@logout')->name('logout');
  7.  
  8. // Registration Routes...
  9. if ($options['register'] ?? true) {
  10. $this->get('admin/register', 'AuthRegisterController@showRegistrationForm')->name('register');
  11. $this->post('admin/register', 'AuthRegisterController@register');
  12. }
  13.  
  14. // Password Reset Routes...
  15. if ($options['reset'] ?? true) {
  16. $this->resetPassword();
  17. }
  18.  
  19. // Email Verification Routes...
  20. if ($options['verify'] ?? false) {
  21. $this->emailVerification();
  22. }
  23. }
  24.  
  25. use RegistersUsers;
  26.  
  27. /**
  28. * Where to redirect users after registration.
  29. *
  30. * @var string
  31. */
  32. protected $redirectTo = '/admin/inicio';
  33.  
  34. /**
  35. * Create a new controller instance.
  36. *
  37. * @return void
  38. */
  39. public function __construct()
  40. {
  41. $this->middleware('auth');
  42. }
  43.  
  44. /**
  45. * Get a validator for an incoming registration request.
  46. *
  47. * @param array $data
  48. * @return IlluminateContractsValidationValidator
  49. */
  50. protected function validator(array $data)
  51. {
  52. return Validator::make($data, [
  53. 'name' => ['required', 'string', 'max:255'],
  54. 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
  55. 'password' => ['required', 'string', 'min:6', 'confirmed'],
  56. ]);
  57. }
  58.  
  59. /**
  60. * Create a new user instance after a valid registration.
  61. *
  62. * @param array $data
  63. * @return AppUser
  64. */
  65. protected function create(array $data)
  66. {
  67.  
  68. return User::create([
  69. 'role' => 'helper',
  70. 'name' => $data['name'],
  71. 'nick' => 'default',
  72. 'email' => $data['email'],
  73. 'password' => Hash::make($data['password']),
  74. ]);
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement