猿问

为什么即使我更改为数字,laravel 仍然验证电子邮件?

我想使用数字而不是电子邮件登录:所以,我将代码更改为:


<div class="panel-body">

   <form class="form-horizontal" method="POST" action="{{ route('login') }}">

   {{ csrf_field() }}

   <div class="form-group{{ $errors->has('matric_no') ? ' has-error' : '' }}">

   <label for="matric_no" class="col-md-4 control-label">Matric No</label>


   <div class="col-md-6">

   <input id="matric_no" class="form-control" type="number" name="matric_no" value="{{ 

   old('matric_no') }}" required autofocus>

   @if ($errors->has('matric_no'))

       <span class="help-block">

       <strong>{{ $errors->first('matric_no') }}</strong>

       </span>

   @endif

   </div>

</div>

但是每次我尝试登录时,错误都是:


电子邮件字段是必需的。


一只甜甜圈
浏览 80回答 1
1回答

一只名叫tom的猫

将此代码插入您的 LoginControllerpublic function username(){&nbsp; &nbsp; return 'matric_no';}
随时随地看视频慕课网APP
我要回答