Skip to content
Advertisement

Laravel: Validation unique on update

I know this question has been asked many times before but no one explains how to get the id when you’re validating in the model.

JavaScript

My validation rule is in the model so how do I pass the ID of the record to the validation rule.

Here is my models/User

JavaScript

models/BaseModel

JavaScript

Advertisement

Answer

One simple solution.

In your Model

JavaScript

In your Controller, action:update

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement