show right modal based on right error type

816 0 0 0

Last Updated : 2024-04-26 02:18:27

how to show right modal based on right error type specially in case that there are 2 modals on the same page

1- use named error bags in one form as


 


return Validator::make($data, [       
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'phone' => ['required', 'string', 'min:11', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
])->validateWithBag('registerErrors'); //this is the error bag

after that you will provide in your blade this code


 


@if( $errors->registerErrors->all() ) // this registerErrors is the name of error bag
<script>
$(document).ready(function() {
$('#signupModal').modal('show');
});
</script>
@endif

the last thing .. this will provide an error with validate on registersusers.php file in vendor/ui/auth-backend/registersusers.php -> go and delete this validate() 

Mahmoud Anwar

Mahmoud Anwar

Back End Developer with a passion for developing innovative web applications that expedite the efficiency and effectiveness of organizational success. Well-versed in technology and writing code to create systems that are reliable and user-friendly. Also has the proven ability to motivate, educate, and collaborate effectively to build web applications and effectively track changes. Confident communicator, strategic thinker, and innovative creator to develop software that is customized to meet a company’s organizational needs, highlight their core competencies, and further their success.