Main first slug

12 Apr 2019

The docs for L4.2 show examples of how to use exists with values for a 'where' clause when checking a database table but there's no example that shows the same thing using the actual value submitted.

The below snippet is from the docs (http://laravel.com/docs/4.2/validation#rule-exists)

// You may also specify more conditions that will be added as "where" clauses to the query:
'email' => 'exists:staff,email,account_id,1'

Using the example above, how would I check the email value submitted exists in the table? The following doesn't work.

'email' => 'exists:staff,email,email,:attribute'