現在、Laravelにてマルチログイン機構を作成しております。
通常のUserのverifyは正常に動くのですが、Adminに相当するユーザ機構にてMustverifyemailを通常通りに導入すると、認証メールに記載されているURLをクリックしても管理テーブルであるAdminsのemail_verified_atがNULLのままtimestampが更新されません。
どこを変えるべきかがわからずにいます。
乱文・長文で申し訳ありませんが、もしお分かりになる方・心当たりのある方がおられましたらご回答いただけますと幸いです。
追記:DBには今回実装しているuserモデルと同じ内容のテーブルでemail_verified_atカラムも存在しており
User側は正常にできているのですが、admin側は同じ方法では上記のようにtimestampが更新されずnullのままです。
php
1//メール認証を実装したいadminモデル 2//userにはメール認証が実装できておりimplemtnsでMustVerifyEmailをしているだけで同じようにadminに実装したところ上記の状態となりました 3 4<?php 5 6namespace App; 7 8use Illuminate\Contracts\Auth\MustVerifyEmail; 9use Illuminate\Foundation\Auth\User as Authenticatable; 10use Illuminate\Notifications\Notifiable; 11use App\Notifications\VerifyEmailJapanese; 12 13class Admin extends Authenticatable implements MustVerifyEmail 14{ 15 use Notifiable; 16 17 /** 18 * The attributes that are mass assignable. 19 * 20 * @var array 21 */ 22 protected $fillable = [ 23 'name', 'email', 'password','postNumber','area','tell','img' 24 ]; 25 26 /** 27 * The attributes that should be hidden for arrays. 28 * 29 * @var array 30 */ 31 protected $hidden = [ 32 'password', 'remember_token', 33 ]; 34 35 /** 36 * The attributes that should be cast to native types. 37 * 38 * @var array 39 */ 40 protected $casts = [ 41 'email_verified_at' => 'datetime', 42 ]; 43 44 public function sendEmailVerificationNotification() 45 { 46 $this->notify(new VerifyEmailJapanese); 47 } 48}
php
1//実装が完了しているuserモデル 2 3<?php 4 5namespace App; 6 7use Illuminate\Contracts\Auth\MustVerifyEmail; 8use Illuminate\Foundation\Auth\User as Authenticatable; 9use Illuminate\Notifications\Notifiable; 10use Laravel\Cashier\Billable; 11use App\Notifications\VerifyEmailJapanese; 12use Illuminate\Database\Eloquent\SoftDeletes; 13 14class User extends Authenticatable implements MustVerifyEmail 15{ 16 use Notifiable; 17 use Billable; 18 use SoftDeletes; 19 20 /** 21 * The attributes that are mass assignable. 22 * 23 * @var array 24 */ 25 protected $fillable = [ 26 'name', 'email', 'password','postNumber','area','tell', 27 ]; 28 29 /** 30 * The attributes that should be hidden for arrays. 31 * 32 * @var array 33 */ 34 protected $hidden = [ 35 'password', 'remember_token', 36 ]; 37 38 /** 39 * The attributes that should be cast to native types. 40 * 41 * @var array 42 */ 43 protected $casts = [ 44 'email_verified_at' => 'datetime', 45 ]; 46 47 public function sendEmailVerificationNotification() 48 { 49 $this->notify(new VerifyEmailJapanese); 50 } 51} 52 53
「どこを変えるべきか」と仰いますが、どのように書いたのかどのような構成(DBも)か分からないと指摘・アドバイスしようがありません。
質問本文を編集して適宜追記してください。
あなたの回答
tips
プレビュー