user() !== null; } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { return [ 'name' => ['required', 'string', 'max:255'], 'event_type' => ['required', 'string', Rule::in(NotificationEventType::values())], 'channel' => ['required', 'string', Rule::in(NotificationChannel::values())], 'channel_configuration' => ['nullable', 'array'], 'channel_configuration.allowed_mentions' => ['nullable', 'array'], 'channel_configuration.allowed_mentions.*' => ['nullable', 'string', Rule::in(DiscordAllowedMentionType::values())], 'enabled' => ['required', 'boolean'], 'delivery_url' => ['nullable', 'string', 'max:2048', 'url'], 'message_template' => [Rule::requiredIf($this->input('channel') === NotificationChannel::Discord->value), 'string', 'max:2000'], ]; } }