request fix
This commit is contained in:
@@ -26,6 +26,10 @@ class StoreProjectNotificationActionRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
$messageTemplateRules = $this->input('channel') === NotificationChannel::Discord->value
|
||||||
|
? ['required', 'string', 'max:2000']
|
||||||
|
: ['nullable', 'string', 'max:2000'];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => ['required', 'string', 'max:255'],
|
'name' => ['required', 'string', 'max:255'],
|
||||||
'event_type' => ['required', 'string', Rule::in(NotificationEventType::values())],
|
'event_type' => ['required', 'string', Rule::in(NotificationEventType::values())],
|
||||||
@@ -35,7 +39,7 @@ class StoreProjectNotificationActionRequest extends FormRequest
|
|||||||
'channel_configuration.allowed_mentions.*' => ['nullable', 'string', Rule::in(DiscordAllowedMentionType::values())],
|
'channel_configuration.allowed_mentions.*' => ['nullable', 'string', Rule::in(DiscordAllowedMentionType::values())],
|
||||||
'enabled' => ['required', 'boolean'],
|
'enabled' => ['required', 'boolean'],
|
||||||
'delivery_url' => ['required', 'string', 'max:2048', 'url'],
|
'delivery_url' => ['required', 'string', 'max:2048', 'url'],
|
||||||
'message_template' => [Rule::requiredIf($this->input('channel') === NotificationChannel::Discord->value), 'string', 'max:2000'],
|
'message_template' => $messageTemplateRules,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ use Illuminate\Validation\Rule;
|
|||||||
|
|
||||||
class UpdateProjectNotificationActionRequest extends FormRequest
|
class UpdateProjectNotificationActionRequest extends FormRequest
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
*/
|
*/
|
||||||
@@ -27,6 +26,10 @@ class UpdateProjectNotificationActionRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
$messageTemplateRules = $this->input('channel') === NotificationChannel::Discord->value
|
||||||
|
? ['required', 'string', 'max:2000']
|
||||||
|
: ['nullable', 'string', 'max:2000'];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => ['required', 'string', 'max:255'],
|
'name' => ['required', 'string', 'max:255'],
|
||||||
'event_type' => ['required', 'string', Rule::in(NotificationEventType::values())],
|
'event_type' => ['required', 'string', Rule::in(NotificationEventType::values())],
|
||||||
@@ -36,7 +39,7 @@ class UpdateProjectNotificationActionRequest extends FormRequest
|
|||||||
'channel_configuration.allowed_mentions.*' => ['nullable', 'string', Rule::in(DiscordAllowedMentionType::values())],
|
'channel_configuration.allowed_mentions.*' => ['nullable', 'string', Rule::in(DiscordAllowedMentionType::values())],
|
||||||
'enabled' => ['required', 'boolean'],
|
'enabled' => ['required', 'boolean'],
|
||||||
'delivery_url' => ['nullable', 'string', 'max:2048', 'url'],
|
'delivery_url' => ['nullable', 'string', 'max:2048', 'url'],
|
||||||
'message_template' => [Rule::requiredIf($this->input('channel') === NotificationChannel::Discord->value), 'string', 'max:2000'],
|
'message_template' => $messageTemplateRules,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user