質問編集履歴
1
補足追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -17,3 +17,85 @@
|
|
17
17
|
|
18
18
|
|
19
19
|
どなたかlaravel8に知見がある方いらっしゃればご教示いただけると幸いです。
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
補足
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
CreateNewUser.phpに registercontroller に似たような記述を発見しましたが自動ログインに関係するような記述は見当たりませんでした。
|
28
|
+
|
29
|
+
```ここに言語を入力
|
30
|
+
|
31
|
+
<?php
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
namespace App\Actions\Fortify;
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
use App\Models\User;
|
40
|
+
|
41
|
+
use Illuminate\Support\Facades\Hash;
|
42
|
+
|
43
|
+
use Illuminate\Support\Facades\Validator;
|
44
|
+
|
45
|
+
use Laravel\Fortify\Contracts\CreatesNewUsers;
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
class CreateNewUser implements CreatesNewUsers
|
50
|
+
|
51
|
+
{
|
52
|
+
|
53
|
+
use PasswordValidationRules;
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
/**
|
58
|
+
|
59
|
+
* Validate and create a newly registered user.
|
60
|
+
|
61
|
+
*
|
62
|
+
|
63
|
+
* @param array $input
|
64
|
+
|
65
|
+
* @return \App\Models\User
|
66
|
+
|
67
|
+
*/
|
68
|
+
|
69
|
+
public function create(array $input)
|
70
|
+
|
71
|
+
{
|
72
|
+
|
73
|
+
Validator::make($input, [
|
74
|
+
|
75
|
+
'name' => ['required', 'string', 'max:255'],
|
76
|
+
|
77
|
+
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
78
|
+
|
79
|
+
'password' => $this->passwordRules(),
|
80
|
+
|
81
|
+
])->validate();
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
return User::create([
|
86
|
+
|
87
|
+
'name' => $input['name'],
|
88
|
+
|
89
|
+
'email' => $input['email'],
|
90
|
+
|
91
|
+
'password' => Hash::make($input['password']),
|
92
|
+
|
93
|
+
]);
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
```
|