Support the ongoing development of Laravel.io →
Authentication Database Validation
Last updated 1 year 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 8 years ago.

dhruvinprajapati liked this reply

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 6 years ago.
0

Sign in to participate in this thread!

Eventy

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.

© 2024 Laravel.io - All rights reserved.