Laravel Exists Validation Code Example
In this laravel validation series tutorial, I will show you how to validate exists() in laravel application. We will use simple rules of laravel validator to check laravel exists validation. In this laravel exists validation tutorial, i want to check username exists on table in laravel app.
So from this article will help you to learn laravel exists valdation example. This exists validation means in laravel that, the field under validation must exist in a given database table. We may explicitly specify the database column name which should be used by the validation rule by placing it after the database table name:
$request->validate([ 'username' => 'required|exists:users,name', ]);
Read also: Laravel Unique Email Validation Example
Hope it can help you.