1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Check expense category name is unique

This commit is contained in:
Hillel Coren 2016-07-07 15:32:31 +03:00
parent 5f8ae65310
commit 3498d28d3f
2 changed files with 2 additions and 1 deletions

View File

@ -21,7 +21,7 @@ class CreateExpenseCategoryRequest extends ExpenseCategoryRequest
public function rules()
{
return [
'name' => 'required',
'name' => sprintf('required|unique:expense_categories,name,,id,account_id,%s', $this->user()->account_id),
];
}
}

View File

@ -21,6 +21,7 @@ class UpdateExpenseCategoryRequest extends ExpenseCategoryRequest
{
return [
'name' => 'required',
'name' => sprintf('required|unique:expense_categories,name,%s,id,account_id,%s', $this->entity()->id, $this->user()->account_id),
];
}
}