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

Posted 4 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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.