How to validate an input field if value is not null in Laravel
In case column is nullable
'password' => 'nullable|min:6|confirmed',
@Rejinderi's answer is correct!
In case column is not nullable (This may help other)
'password' => 'sometimes|required|min:6|confirmed',
Result
username = 'admin',
password = null // fail- required
username = 'admin',
password = 123 // fail- min:6
username = 'admin' // pass- validate only exist
try using nullable as a rule
'password' => 'nullable|min:6|confirmed',
see https://laravel.com/docs/5.8/validation#a-note-on-optional-fields