本文介绍了语法错误,意外'如果'(T_IF),期待']'可以有人帮助我,我被卡住了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿,我想编写一个查询,当你点击登录时会检查余额,它会显示一条有你余额的信息,但是如果你没有余额,它将允许你登录laravel .Below就是我所拥有的试过。余额清单在另一张名为违约者的表格中。
我尝试过:
受保护的函数validateLogin(请求$请求)
{
//SELECT * from defaulters where myPIN =>'$ myPIN'
// union
$ defaulters = Defaulters_Reg :: select('Debt_amount') - > where('myPIN',$ id) - > get();
$ request-> validate([
'myPIN'=>'required | myPIN',
'Endt_amount'=>'required | string'
if($ validateLogin-> failed())
{
返回Redirect :: to('login')
}
])
$ request-> ;验证([
$ this-> username()=>'required | string',
'password'=>'required | string',
]);
}
解决方案
hey i want to write a query that will check for balance when you click login and it will show a message that has your balance but if you dont have a balance it will allow you to login in laravel .Below is what i have tried.the list of balance is in another table called defaulters.
What I have tried:
protected function validateLogin(Request $request) { // "SELECT * from defaulters where myPIN => '$myPIN'" // union $defaulters = Defaulters_Reg::select('Debt_amount')->where('myPIN',$id)->get(); $request->validate([ 'myPIN' => 'required|myPIN', 'Debt_amount' => 'required|string' if ($validateLogin->fails()) { return Redirect::to ('login') } ]) $request->validate([ $this->username() => 'required|string', 'password' => 'required|string', ]); }
解决方案
这篇关于语法错误,意外'如果'(T_IF),期待']'可以有人帮助我,我被卡住了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!