Laravel sometimes validation rule

后端 未结 7 2202
孤街浪徒
孤街浪徒 2021-02-08 07:38

I am trying to validate a password field only if it is present. I want to allow someone to edit a user and they may or may not want to change the users password. So I thought I

7条回答
  •  难免孤独
    2021-02-08 08:26

    Laravel sometimes validation rule and their function:

    accepted The field under validation must be yes, on, 1, or true. This is useful for validating "Terms of Service" acceptance.

    active_url The field under validation must have a valid A or AAAA record according to the dns_get_record PHP function.

    after:date The field under validation must be a value after a given date. The dates will be passed into the strtotime PHP function: 'start_date' => 'required|date|after:tomorrow' Instead of passing a date string to be evaluated by strtotime, you may specify another field to compare against the date: 'finish_date' => 'required|date|after:start_date'

    after_or_equal:date The field under validation must be a value after or equal to the given date. For more information, see the after rule.

    alpha The field under validation must be entirely alphabetic characters.

提交回复
热议问题