DEV Community

Discussion on: Using the unique validation rule in a Laravel Form Request

Collapse
 
chrisrhymes profile image
C.S. Rhymes

In a separate form request class you can also add authorisation, such as checking if the current user has permission to edit the post, and custom validation messages, such as changing the unique message to say something like “Sorry, someone has already used that post title. Please try another one.”.

Collapse
 
msamgan profile image
Mohammed Samgan Khan

yes, I understood. Moreover, I think we can also achieve that by creating a train like "Methods" and attaching that to the Model layer. sounds cool to you?