@php $isNew = ! $campaign->exists; // Built here, NOT inline in the attribute. A multi-line closure inside // @json() sitting in an HTML attribute is fragile, and it blows up the // whole page if $steps is ever missing. Coerced through collect() so a // null/array/Collection all behave, and `body` is read once here rather // than decrypting inside the attribute. // Merge-tag braces built by concatenation so the literal sequence never // appears in the template. Blade reads {{name}} as an echo wherever it // finds it — including inside a string — and rewrites the surrounding // line into broken PHP. Same guard the Shopify view uses. $lb = '{' . '{'; $rb = '}' . '}'; $bodyPlaceholder = __('Message to send. Use :a or :b for personalisation.', [ 'a' => $lb . 'name' . $rb, 'b' => $lb . 'first_name' . $rb, ]); $stepsPayload = collect($steps ?? [])->map(fn ($s) => [ 'delay_amount' => (int) ($s->delay_amount ?? 0), 'delay_unit' => (string) ($s->delay_unit ?? 'hour'), 'body' => (string) ($s->body ?? ''), 'template_id' => $s->template_id ?? null, 'var_map' => is_array($s->var_map ?? null) ? $s->var_map : [], ])->values(); @endphp
@if (session('success'))
{{ session('success') }}
@endif @if ($errors->any())
@foreach ($errors->all() as $e)
{{ $e }}
@endforeach
@endif
@csrf @unless ($isNew) @method('PUT') @endunless
{{-- ============ SETTINGS RAIL ============ --}} {{-- ============ STEP BUILDER ============ --}}
{{ __('Drip campaigns') }} / {{ $isNew ? __('New') : __('Edit') }}

{{ __('The') }} {{ __('sequence') }}

{{ __('Each step waits, then sends. The wait is measured from the previous step — so "1 day" on step 2 means one day after step 1 went out.') }}

{{ __('No steps yet. Add the first message — set its wait to 0 to send as soon as someone is enrolled.') }}
@unless ($isNew) {{-- Manual enrolment --}}
@csrf

{{ __('Enrol contacts') }}

{{ __('Adds everyone in a group at step 1. Already-enrolled contacts are skipped, so you can run this again safely.') }}

@endunless