Support the ongoing development of Laravel.io →
Authentication Database Validation
Last updated 3 years ago.
0

Try the unique rule with with additional where clause

'name' => 'unique:games,name,NULL,id,user_id,'.$user->id

http://laravel.com/docs/5.1/validation#rule-unique

Last updated 10 years ago.
1

Thank you so much, it works perfectly!

0

If using auth:

public function rules() {
	return [
		'email' => 'required|email|unique:users,email,NULL,id,deleted_at,NULL,department_id,' . auth()->user()->department_id,
	];
}
Last updated 8 years ago.
0

Sign in to participate in this thread!

Native PHP

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.