if any error in blade laravel
@if ($errors->any())
@foreach ($errors->all() as $error)
<div>{{$error}}</div>
@endforeach
@endif
if any error in blade laravel
@if ($errors->any())
@foreach ($errors->all() as $error)
<div>{{$error}}</div>
@endforeach
@endif
laravel unique validation
unique:table,column,except,idColumn
############## Example : ################
############### For Updating
//rules
'email' => 'unique:users,email_address,' . $userId,
############### For Creating
//rules
'email' => 'unique:users,email_address',
laravel custom validation check if valid url
I have created a custom Validator like:
Validator::extend('german_url', function($attribute, $value, $parameters) {
$url = str_replace(["ä","ö","ü"], ["ae", "oe", "ue"], $value);
return filter_var($url, FILTER_VALIDATE_URL);
});
My rules contain now:
"url" => "required|german_url,
Also don't forget to add the rule to your validation.php file
"german_url" => ":attribute is not a valid URL",
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us