Add avatars, profiles, and auth flows
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Actions\Fortify;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
@@ -19,8 +20,16 @@ class CreateNewUser implements CreatesNewUsers
|
||||
*/
|
||||
public function create(array $input): User
|
||||
{
|
||||
$input['name_canonical'] = Str::lower(trim($input['name'] ?? ''));
|
||||
|
||||
Validator::make(data: $input, rules: [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'name_canonical' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
Rule::unique(table: User::class, column: 'name_canonical'),
|
||||
],
|
||||
'email' => [
|
||||
'required',
|
||||
'string',
|
||||
@@ -33,6 +42,7 @@ class CreateNewUser implements CreatesNewUsers
|
||||
|
||||
return User::create(attributes: [
|
||||
'name' => $input['name'],
|
||||
'name_canonical' => $input['name_canonical'],
|
||||
'email' => $input['email'],
|
||||
'password' => Hash::make(value: $input['password']),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user