Unique rule only current user except other user

 use Illuminate\Validation\Rule;

 'name' =>[Rule::unique('statistics', 'name')
->where(fn ($query) =>
$query->where('user_id', $user_id)),'string','max:200'],

Comments