改进
This commit is contained in:
parent
cc7a32ff4d
commit
6269ba1a55
@ -17,7 +17,7 @@ class RegisterController extends Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users as well as their
|
||||
| validation and creation. By default this controller uses a trait to
|
||||
| validation and creation. By default, this controller uses a trait to
|
||||
| provide this functionality without requiring any additional code.
|
||||
|
|
||||
*/
|
||||
@ -47,7 +47,7 @@ public function __construct()
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
protected function validator(array $data): \Illuminate\Contracts\Validation\Validator
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
@ -60,11 +60,11 @@ protected function validator(array $data)
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \App\Models\User
|
||||
* @return User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
protected function create(array $data): User
|
||||
{
|
||||
return User::create([
|
||||
return (new User)->create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => Hash::make($data['password']),
|
||||
|
Loading…
Reference in New Issue
Block a user