質問編集履歴

2

ソースコードの追加

2019/11/04 09:23

投稿

kyutaro
kyutaro

スコア34

test CHANGED
File without changes
test CHANGED
@@ -8,6 +8,12 @@
8
8
 
9
9
 
10
10
 
11
+ 追記:DBには今回実装しているuserモデルと同じ内容のテーブルでemail_verified_atカラムも存在しており
12
+
13
+ User側は正常にできているのですが、admin側は同じ方法では上記のようにtimestampが更新されずnullのままです。
14
+
15
+
16
+
11
17
 
12
18
 
13
19
 
@@ -115,3 +121,115 @@
115
121
  }
116
122
 
117
123
  ```
124
+
125
+
126
+
127
+ ```php
128
+
129
+ //実装が完了しているuserモデル
130
+
131
+
132
+
133
+ <?php
134
+
135
+
136
+
137
+ namespace App;
138
+
139
+
140
+
141
+ use Illuminate\Contracts\Auth\MustVerifyEmail;
142
+
143
+ use Illuminate\Foundation\Auth\User as Authenticatable;
144
+
145
+ use Illuminate\Notifications\Notifiable;
146
+
147
+ use Laravel\Cashier\Billable;
148
+
149
+ use App\Notifications\VerifyEmailJapanese;
150
+
151
+ use Illuminate\Database\Eloquent\SoftDeletes;
152
+
153
+
154
+
155
+ class User extends Authenticatable implements MustVerifyEmail
156
+
157
+ {
158
+
159
+ use Notifiable;
160
+
161
+ use Billable;
162
+
163
+ use SoftDeletes;
164
+
165
+
166
+
167
+ /**
168
+
169
+ * The attributes that are mass assignable.
170
+
171
+ *
172
+
173
+ * @var array
174
+
175
+ */
176
+
177
+ protected $fillable = [
178
+
179
+ 'name', 'email', 'password','postNumber','area','tell',
180
+
181
+ ];
182
+
183
+
184
+
185
+ /**
186
+
187
+ * The attributes that should be hidden for arrays.
188
+
189
+ *
190
+
191
+ * @var array
192
+
193
+ */
194
+
195
+ protected $hidden = [
196
+
197
+ 'password', 'remember_token',
198
+
199
+ ];
200
+
201
+
202
+
203
+ /**
204
+
205
+ * The attributes that should be cast to native types.
206
+
207
+ *
208
+
209
+ * @var array
210
+
211
+ */
212
+
213
+ protected $casts = [
214
+
215
+ 'email_verified_at' => 'datetime',
216
+
217
+ ];
218
+
219
+
220
+
221
+ public function sendEmailVerificationNotification()
222
+
223
+ {
224
+
225
+ $this->notify(new VerifyEmailJapanese);
226
+
227
+ }
228
+
229
+ }
230
+
231
+
232
+
233
+
234
+
235
+ ```

1

ソースコードの追加

2019/11/04 09:23

投稿

kyutaro
kyutaro

スコア34

test CHANGED
File without changes
test CHANGED
@@ -5,3 +5,113 @@
5
5
  どこを変えるべきかがわからずにいます。
6
6
 
7
7
  乱文・長文で申し訳ありませんが、もしお分かりになる方・心当たりのある方がおられましたらご回答いただけますと幸いです。
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+ ```php
20
+
21
+ //メール認証を実装したいadminモデル
22
+
23
+ //userにはメール認証が実装できておりimplemtnsでMustVerifyEmailをしているだけで同じようにadminに実装したところ上記の状態となりました
24
+
25
+
26
+
27
+ <?php
28
+
29
+
30
+
31
+ namespace App;
32
+
33
+
34
+
35
+ use Illuminate\Contracts\Auth\MustVerifyEmail;
36
+
37
+ use Illuminate\Foundation\Auth\User as Authenticatable;
38
+
39
+ use Illuminate\Notifications\Notifiable;
40
+
41
+ use App\Notifications\VerifyEmailJapanese;
42
+
43
+
44
+
45
+ class Admin extends Authenticatable implements MustVerifyEmail
46
+
47
+ {
48
+
49
+ use Notifiable;
50
+
51
+
52
+
53
+ /**
54
+
55
+ * The attributes that are mass assignable.
56
+
57
+ *
58
+
59
+ * @var array
60
+
61
+ */
62
+
63
+ protected $fillable = [
64
+
65
+ 'name', 'email', 'password','postNumber','area','tell','img'
66
+
67
+ ];
68
+
69
+
70
+
71
+ /**
72
+
73
+ * The attributes that should be hidden for arrays.
74
+
75
+ *
76
+
77
+ * @var array
78
+
79
+ */
80
+
81
+ protected $hidden = [
82
+
83
+ 'password', 'remember_token',
84
+
85
+ ];
86
+
87
+
88
+
89
+ /**
90
+
91
+ * The attributes that should be cast to native types.
92
+
93
+ *
94
+
95
+ * @var array
96
+
97
+ */
98
+
99
+ protected $casts = [
100
+
101
+ 'email_verified_at' => 'datetime',
102
+
103
+ ];
104
+
105
+
106
+
107
+ public function sendEmailVerificationNotification()
108
+
109
+ {
110
+
111
+ $this->notify(new VerifyEmailJapanese);
112
+
113
+ }
114
+
115
+ }
116
+
117
+ ```