Home  >  Q&A  >  body text

Validation rules - In laravel5.1, do you need to write a request each for add and edit when request verification?

When adding, it is necessary to verify whether the user name is repeated.
When editing, there is no need to verify whether the user name is repeated.
How to distinguish and write request verification rules at this time?

PHP中文网PHP中文网2735 days ago402

reply all(1)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-16 16:50:43

    Hope it can give you some inspiration

    Refer to the official document Forcing A Unique Rule To Ignore A Given ID section

    reply
    0
  • Cancelreply