diff --git a/app/Api/v1/Requests/GroupStoreRequest.php b/app/Api/v1/Requests/GroupStoreRequest.php index 9a22a92f..ffb87716 100644 --- a/app/Api/v1/Requests/GroupStoreRequest.php +++ b/app/Api/v1/Requests/GroupStoreRequest.php @@ -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 + */ + public function messages(): array + { + return [ + 'name.not_in' => __('errors.reserved_name_please_choose_something_else'), + ]; + } } diff --git a/resources/lang/en/errors.php b/resources/lang/en/errors.php index 29c6ffc6..f87217ed 100644 --- a/resources/lang/en/errors.php +++ b/resources/lang/en/errors.php @@ -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', ]; \ No newline at end of file