40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Actions\Fortify;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Support\Facades\Hash;
|
|
use Illuminate\Support\Facades\Validator;
|
|
use Laravel\Fortify\Contracts\CreatesNewUsers;
|
|
use Laravel\Jetstream\Jetstream;
|
|
|
|
class CreateNewUser implements CreatesNewUsers
|
|
{
|
|
use PasswordValidationRules;
|
|
|
|
/**
|
|
* Validate and create a newly registered user.
|
|
*
|
|
* @param array<string, string> $input
|
|
*/
|
|
public function create(array $input): User
|
|
{
|
|
Validator::make($input, [
|
|
'USER_ID' => ['required', 'string', 'max:30', 'unique:SITE_USER_INFO,USER_ID'],
|
|
'USER_PWD' => ['required', 'string', 'min:8'],
|
|
'USER_EMAIL' => ['nullable', 'string', 'email', 'max:40'],
|
|
'USER_NCNM' => ['nullable', 'string', 'max:50'],
|
|
])->validate();
|
|
|
|
return User::create([
|
|
'USER_ID' => $input['USER_ID'],
|
|
'USER_PWD' => Hash::make($input['USER_PWD']), // 비밀번호 암호화 저장
|
|
'USER_NCNM' => $input['USER_NCNM'] ?? null,
|
|
'USER_EMAIL' => $input['USER_EMAIL'] ?? null,
|
|
'USER_HP' => $input['USER_HP'] ?? null,
|
|
'USER_STATUS' => '01', // 기본적으로 활성화 상태
|
|
'REG_DTTM' => now(), // 등록 날짜 자동 설정
|
|
]);
|
|
}
|
|
}
|