Walidacja e -mail w Laravel
'email' => 'required|email|unique:users,email',
//@sujay
$uj@y
'email' => 'required|email|unique:users,email',
//@sujay
@if ($errors->any())
@foreach ($errors->all() as $error)
<div>{{$error}}</div>
@endforeach
@endif
$this->validate([ // 1st array is field rules
'userid' =>'required|min:3|max:100',
'username' =>'required|min:3',
'password' =>'required|max:15|confirmed',
], [ // 2nd array is the rules custom message
'required' => 'The :attribute field is mandatory.'
], [ // 3rd array is the fields custom name
'userid' => 'User ID'
]);
//Controller code
Route::post('/user/profile', function () {
// ...
return redirect('dashboard')->with('status', 'Profile updated!');
});
//view code
@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif