Reject group creation with reserved 'All' name

This commit is contained in:
Bubka 2025-02-19 11:16:13 +01:00
parent 180f8e3448
commit ceb9d69478
2 changed files with 14 additions and 0 deletions

View File

@ -30,8 +30,21 @@ class GroupStoreRequest extends FormRequest
'required',
'regex:/^[A-zÀ-ú0-9\s\-_]+$/',
'max:32',
Rule::notIn([__('commons.all')]),
Rule::unique('groups')->where(fn ($query) => $query->where('user_id', $this->user()->id)),
],
];
}
/**
* Get the error messages for the defined validation rules.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'name.not_in' => __('errors.reserved_name_please_choose_something_else'),
];
}
}

View File

@ -74,4 +74,5 @@ return [
'qrcode_has_invalid_checksum' => 'QR code has invalid checksum',
'no_readable_qrcode' => 'No readable QR code',
'failed_icon_store_database_toggling' => 'Migration of icons failed. The setting has been restored to its previous value.',
'reserved_name_please_choose_something_else' => 'Reserved name, please choose something else',
];