@@ -46,47 +46,6 @@ public function __construct()
46
46
->only (['confirm ' , 'resendConfirmationEmail ' ]);
47
47
}
48
48
49
- /**
50
- * Get a validator for an incoming registration request.
51
- *
52
- * @param array $data
53
- *
54
- * @return \Illuminate\Contracts\Validation\Validator
55
- */
56
- protected function validator (array $ data )
57
- {
58
- return Validator::make ($ data , [
59
- 'name ' => 'required|string|max:255 ' ,
60
- 'student_number ' => 'required|string|unique:students,student_number|student_number ' ,
61
- 'password ' => 'required|string|min:6|confirmed ' ,
62
- ]);
63
- }
64
-
65
- /**
66
- * Create a new user instance after a valid registration.
67
- *
68
- * @param array $data
69
- *
70
- * @return \App\Judite\Models\User
71
- */
72
- protected function create (array $ data )
73
- {
74
- $ user = DB ::transaction (function () use ($ data ) {
75
- $ user = User::make ([
76
- 'name ' => $ data ['name ' ],
77
- 'email ' => $ data ['student_number ' ].'@alunos.uminho.pt ' ,
78
- 'password ' => bcrypt ($ data ['password ' ]),
79
- ]);
80
- $ user ->verification_token = str_random (32 );
81
- $ user ->save ();
82
- $ user ->student ()->create (['student_number ' => $ data ['student_number ' ]]);
83
-
84
- return $ user ;
85
- });
86
-
87
- return $ user ;
88
- }
89
-
90
49
/**
91
50
* Confirm a student account.
92
51
*
@@ -133,6 +92,47 @@ public function resendConfirmationEmail()
133
92
return redirect ($ this ->redirectTo );
134
93
}
135
94
95
+ /**
96
+ * Get a validator for an incoming registration request.
97
+ *
98
+ * @param array $data
99
+ *
100
+ * @return \Illuminate\Contracts\Validation\Validator
101
+ */
102
+ protected function validator (array $ data )
103
+ {
104
+ return Validator::make ($ data , [
105
+ 'name ' => 'required|string|max:255 ' ,
106
+ 'student_number ' => 'required|string|unique:students,student_number|student_number ' ,
107
+ 'password ' => 'required|string|min:6|confirmed ' ,
108
+ ]);
109
+ }
110
+
111
+ /**
112
+ * Create a new user instance after a valid registration.
113
+ *
114
+ * @param array $data
115
+ *
116
+ * @return \App\Judite\Models\User
117
+ */
118
+ protected function create (array $ data )
119
+ {
120
+ $ user = DB ::transaction (function () use ($ data ) {
121
+ $ user = User::make ([
122
+ 'name ' => $ data ['name ' ],
123
+ 'email ' => $ data ['student_number ' ].'@alunos.uminho.pt ' ,
124
+ 'password ' => bcrypt ($ data ['password ' ]),
125
+ ]);
126
+ $ user ->verification_token = str_random (32 );
127
+ $ user ->save ();
128
+ $ user ->student ()->create (['student_number ' => $ data ['student_number ' ]]);
129
+
130
+ return $ user ;
131
+ });
132
+
133
+ return $ user ;
134
+ }
135
+
136
136
/**
137
137
* The user has been registered.
138
138
*
0 commit comments