为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

PHP
一只甜甜圈 2022-06-11 18:22:16
我想使用数字而不是电子邮件登录:所以,我将代码更改为:<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>但是每次我尝试登录时,错误都是:电子邮件字段是必需的。
查看完整描述

1 回答

?
一只名叫tom的猫

TA贡献1906条经验 获得超3个赞

将此代码插入您的 LoginController


public function username()

{

    return 'matric_no';

}


查看完整回答
反对 回复 2022-06-11
  • 1 回答
  • 0 关注
  • 79 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号