• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
listErrors() always displays error

#4
Indeed, but I have been looking for a way to display errors tied to its input field. I just wanted to say that my problem is solved, and the solution is to be found in Myth/auth:

Controller:
PHP Code:
$rules = [
            
'login'    => 'required',
            
'password' => 'required',
        ];
        
//.............

        
if (! $this->validate($rules))
        {
            return 
redirect()->back()->withInput()->with('errors'$this->validator->getErrors());
        }
//............ 
view:
PHP Code:
<div class="form-group">
                            <
label for="login"><?=lang('Auth.emailOrUsername')?></label>
                            <input type="text" class="form-control <?php if(session('errors.login')) : ?>is-invalid<?php endif ?>"
                                   name="login" value="<?= old('login');?>" placeholder="<?=lang('Auth.emailOrUsername')?>">
                            <div class="invalid-feedback">
                                <?= session('errors.login'?>
                            </div>
                        </div> 
Reply


Messages In This Thread
listErrors() always displays error - by muuucho - 03-13-2020, 04:03 AM
RE: listErrors() always displays error - by muuucho - 04-14-2020, 04:45 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.