5 years ago

Laravel 5 Validation Request, how to handle validation on update?

Posted 5 years ago by Raymond

First of all I love the way that validation is going through, can now easily use

 public function authorize(Authenticator $auth)
    return $auth->user()->hasRole('administrator');

That's not the problem, I bump always into another problem... that is when you update an record, how to do things with the rules? If I need to update an email, I need the following string: 'email' => 'unique:users,email_address,10'. In this case it should look like:

public function rules()
    return [
   'email' => 'required|unique:users,id,?????',
   'tags' => 'required'

Who can help me with this issue?

Please sign in or create an account to participate in this conversation.