user()?->can('manage-settings') ?? false; } public function rules(): array { return [ 'type' => ['required', 'in:email'], 'name' => ['nullable', 'string', 'max:255'], 'description' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], // Common payload for all items 'payload' => ['required', 'array'], 'payload.mail_profile_id' => ['nullable', 'integer', 'exists:mail_profiles,id'], 'payload.template_id' => ['nullable', 'integer', 'exists:email_templates,id'], 'payload.subject' => ['nullable', 'string', 'max:255'], 'payload.body_text' => ['nullable', 'string', 'max:10000'], 'payload.variables' => ['nullable', 'array'], // Source contracts to derive items from 'contract_ids' => ['required', 'array', 'min:1'], 'contract_ids.*' => ['integer', 'exists:contracts,id'], ]; } }