Skip to content
Snippets Groups Projects
Commit b4929908 authored by Shizuco's avatar Shizuco
Browse files

feat: rule for the unique name for category and retailer

parent e76fb46f
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,9 @@ public function fields(NovaRequest $request)
return [
Text::make('Name')
->sortable()
->rules('required', 'max:255', new isNameForCategoryAvaiable),
->rules('required', 'max:255', new isNameForCategoryAvaiable)
->creationRules('unique:categories,name')
->updateRules('unique:categories,name,{{resourceId}}'),
];
}
......
......@@ -23,7 +23,9 @@ public function fields(NovaRequest $request)
return [
Text::make('Name')
->sortable()
->rules('required', 'max:255'),
->rules('required', 'max:255')
->creationRules('unique:retailers,name')
->updateRules('unique:retailers,name,{{resourceId}}'),
];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment