改进 自动用户名
This commit is contained in:
parent
eb93930a65
commit
0eadac1385
@ -6,7 +6,6 @@
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Providers\RouteServiceProvider;
|
use App\Providers\RouteServiceProvider;
|
||||||
use Faker\Provider\zh_CN\Person;
|
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
@ -58,7 +57,7 @@ protected function validator(array $data): \Illuminate\Contracts\Validation\Vali
|
|||||||
protected function create(array $data): User
|
protected function create(array $data): User
|
||||||
{
|
{
|
||||||
return (new User)->create([
|
return (new User)->create([
|
||||||
'name' => $data['name'] ?? '随机 - '.Person::firstNameMale(),
|
'name' => $data['name'] ?? null,
|
||||||
'email' => $data['email'],
|
'email' => $data['email'],
|
||||||
'password' => Hash::make($data['password']),
|
'password' => Hash::make($data['password']),
|
||||||
]);
|
]);
|
||||||
|
Loading…
Reference in New Issue
Block a user