私はlaravel 5.3でプロジェクトを作成しています。ログインを変更しようとしているときにエラーが発生しました。別の列にLaravelの上書きユーザー名が機能しない
タイトルには「メール」ではなく別の列を使用してログインしようとしています。なぜなら、各ユーザーに対して3つのメールがあるからです。ですから、最初はユーザー名の取得元を変更するだけです。私はすでに以下のことをしていました。
私はこのように別のモデルに耳を傾けるconfig/auth.php
ファイルに編集:私のLoginController.php
ファイルで
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\Guest::class,
]
]
もが、私はこれで、関数名をオーバーライドします。
public function username()
{
return 'email1';
}
これは与えるものではありません。私には何らかのエラーがありますが、データベースにある資格情報でログインしようとするとリダイレクトされません。誰でも簡単な答えを知っていますか?ありがとうございました!
EDIT:
Schema::create('guests', function(Blueprint $table){
$table->increments('id');
$table->string('hash')->nullable();
$table->string('password', 60)->nullable();
$table->rememberToken();
$table->string('ip')->nullable();
$table->integer('reunion_id')->unsigned();
$table->string('last_name');
$table->string('middle_name')->nullable();
$table->string('nickname')->nullable();
$table->string('first_name');
$table->string('initials')->nullable();
$table->string('sex')->nullable();
$table->date('birthdate')->nullable();
$table->string('address')->nullable();
$table->string('postcode')->nullable();
$table->string('city')->nullable();
$table->string('location')->nullable();
$table->string('country')->nullable();
$table->string('mobile1')->nullable();
$table->string('mobile2')->nullable();
$table->string('mobile3')->nullable();
$table->string('phone1')->nullable();
$table->string('phone2')->nullable();
$table->string('phone3')->nullable();
$table->string('email1')->nullable()->unique();
$table->string('email2')->nullable();
$table->string('email3')->nullable();
$table->integer('graduation')->nullable();
$table->string('level')->nullable();
$table->boolean('deceased')->nullable();
$table->text('comment')->nullable();
$table->string('linkedin')->nullable();
$table->string('facebook')->nullable();
$table->string('twitter')->nullable();
$table->string('instagram')->nullable();
$table->boolean('found')->default(false);
$table->boolean('claimed')->default(false);
$table->boolean('confirmed')->default(false);
$table->boolean('ticket')->default(false);
$table->timestamps();
});
は、私は、テーブル名がゲストとモデルのゲストであることを認識し、それらが接続されている
ログインしようとしているときどうなっていますか? 'ゲスト'モデルには何がありますか? – GiuServ
@GiuServ編集ファイルを見てください。何も起こっていません。なんらかの理由でページを更新するだけです。間違っているか正しいページにリダイレクトされません。 – Hoffie
ok @Hoffie、ゲストは 'Authenticatable'クラスを拡張していますか? – GiuServ