2016-11-10 7 views

答えて

1

これまでのところすべて正しいことをしています。 emailフィールド以外で認証する場合は、そのままusername()メソッドをオーバーライドする必要があります。しかし、おそらくあなたはログインビューを変更しなかったと思います。テキストフィールドの名前を変更する必要があります。私は、ビュー/ AUTH/login.blade.phpと、このコードの塊について話しています:

<div class="form-group {{ $errors->first('email', 'has-error') }}"> 
     {!! Form::label('email', trans('account/form.email'), ['class' => 'col-sm-2 control-label']) !!} 
     <div class="col-sm-4"> 
      {!! Form::text('email', old('email'), ['class' => 'form-control']) !!} 
     </div> 
     <div class="col-sm-4"> 
      {!! $errors->first('email', '<span class="help-block">:message</span>') !!} 
     </div> 
    </div> 

usernameですべてのemailを交換してください。

0

あなたはそれがその後、「128」を行目に移動「を照らし\財団\認証\ AuthenticatesUsers.php」で、「AuthenticatesUsers」形質に行き、アプリケーション全体のために変更したい場合は、これを見つける必要があります。

/** 
    * Get the login username to be used by the controller. 
    * 
    * @return string 
    */ 
    public function username() 
    { 
     return 'email'; 
    } 

に変更し、それを:

/** 
    * Get the login username to be used by the controller. 
    * 
    * @return string 
    */ 
    public function username() 
    { 
     return 'name'; 
    } 
関連する問題