The name has already been taken. I am in the edit form. I want to update the form. when I updated this form. I get this message.
The name has already been taken.
public function rules(): array
{
return [
'name' => [
'required',
'string',
Rule::unique('permissions')->ignore($this->id),
]
];
}
}
What is $this->id; probably not the ID of the Permission instance you are updating? If you are using Route-Model binding and the URL wildcard is {permission}, try this instead:
Rule::unique('permissions')->ignore($this->route('permission')),
Otherwise, replace 'permission' with whatever the wildcard is, e.g. $this->route('id')
what is the route ? Does it have an {id} element?
Please sign in or create an account to participate in this conversation.