URL Shortener 1.0
A Laravel-based URL shortener application
Chargement...
Recherche...
Aucune correspondance
CreateNewUser.php
Aller à la documentation de ce fichier.
1<?php
2
4
6use Illuminate\Support\Facades\Hash;
7use Illuminate\Support\Facades\Validator;
8use Illuminate\Validation\Rule;
9use Laravel\Fortify\Contracts\CreatesNewUsers;
10
11class CreateNewUser implements CreatesNewUsers
12{
13 use PasswordValidationRules;
14
20 public function create(array $input): User
21 {
22 Validator::make($input, [
23 'name' => ['required', 'string', 'max:255'],
24 'email' => [
25 'required',
26 'string',
27 'email',
28 'max:255',
29 Rule::unique(User::class),
30 ],
31 'password' => $this->passwordRules(),
32 ])->validate();
33
34 return User::create([
35 'name' => $input['name'],
36 'email' => $input['email'],
37 'password' => Hash::make($input['password']),
38 ]);
39 }
40}
create(array $input)
Validate and create a newly registered user.