Demo Mode: you're exploring a live BackupMGR panel with sample data. Everything is read-only. Get BackupMGR →

License Key Required

No license key entered. Enter or update your key with php artisan realestate:license <key>, or purchase one at scriptgain.com.

Form

admin.forms._form

Status Shipped Default Shipped File resources/views/admin/forms/_form.blade.php
admin.forms._form 127 lines
Not Checked Yet

Optional. Shown in the version history so the next person knows why.

Saving runs the same check. An invalid template is refused, not stored.

Compiled PHP

What Blade turns your template into. This is what the syntax check parses.

Loading…

Available Variables And Components

A guide to what this template can use, derived from the shipped source. Click any item to insert it at your cursor. It is a helpful reference, not a runtime guarantee.

Always Available

Shared with the admin panel by the staff layout.
Validation error bag. Always present. Pairs with @error('field').
The admin sidebar navigation structure.
Sub-items of the currently open nav group.
Breadcrumb trail for the current page.
Signed-in staffer's initials, for the avatar.
Signed-in staffer's name.
Signed-in staffer's email address.
The staffer's role, e.g. "Administrator".
True when the signed-in staffer is an administrator.
Number of open service requests, for the badge.
Number of unread form submissions, for the badge.
The configured admin-shell width class.
URL of the uploaded site logo, or null.
URL of the uploaded favicon, or null.

In This Template

A collection of departments.
Field Types.
Record.

Drop any of these in. Click to insert the opening tag at your cursor.

General

type, info, title
initials, src, name, size, md
color, neutral, dot
action, label, Record, modal
variant, primary, size, md, href, …
title, subtitle, padding, flush
name, action, method, POST, title, …
action, name, title, message, confirm, …
href, icon, danger
align, right, width
icon, folder, title, description
label, for, hint, error, required
href, icon, title, variant, secondary, …
name
type, text
name, title, subtitle, icon, tone, …
href, icon, active
title, subtitle, icon, back
title, subtitle, href, linkLabel
ids
id, label, Row
items
label, value, icon, trend, trendColor, …
color, neutral, pulse, label
name
flush
tabs, default
name, checked, label, description

Admin Panel

title, message, icon, folder, href, …
tree, active, rootLabel, rootHref
title, subtitle, icon, edit, action, …
title, icon, folder, subtitle, records, …
search, placeholder, createHref, createLabel
edit, delete, preview, name, title, …
record, kind, Page

Layouts

title, shellMaxWidth
title, description, heroless, maxWidth

Records

name, action, reference, trigger, icon

Site (Public)

href, title, description, icon, meta, …
title, message, icon, folder
title, subtitle, eyebrow, icon, crumbs, …
supportEmail, supportPhone
disclaimer, takedownContact, retentionDays, compact
title, subtitle, href, linkLabel, tone, …
maxWidth

Common Blade

Print a value, safely escaped. The default choice.
Print raw HTML. Only for content you trust.
Show something conditionally.
Loop over a collection.
Loop, with a fallback when the collection is empty.
Show a validation message for a field.
A small block of PHP. Never on line 1. Keep logic out of templates.
A comment that never reaches the browser.

Civic Helpers

Build a URL to a named route, e.g. a department page.
Link to a single news post.
Turn a stored upload path into a public URL.
A cache-busted URL for a bundled asset.
Read a config value, e.g. the site width class.
Build an absolute URL to a path.

No History Yet

Every save, revert, and reset of this template is recorded here, with a one-click way back to any of them.

The Template That Shipped With The Product

Read only. This is what Reset To Default puts back.

<x-card title="Form Details">
    <div class="grid gap-5 sm:grid-cols-2">
        <x-field label="Form Name" for="name" required :error="$errors->first('name')">
            <x-input id="name" name="name" :value="old('name', $record->name)" required />
        </x-field>

        <x-field label="Department" for="department_id" :error="$errors->first('department_id')">
            <x-select id="department_id" name="department_id">
                <option value="">Not Department Specific</option>
                @foreach ($departments as $department)
                    <option value="{{ $department->id }}" @selected(old('department_id', $record->department_id) == $department->id)>{{ $department->name }}</option>
                @endforeach
            </x-select>
        </x-field>

        <x-field label="Introduction" for="description" class="sm:col-span-2" hint="Shown above the form on the public page." :error="$errors->first('description')">
            <textarea id="description" name="description" rows="3"
                      class="block w-full rounded-lg border-0 py-2 px-3 text-sm text-slate-900 ring-1 ring-inset ring-slate-300 focus:ring-2 focus:ring-brand-600">{{ old('description', $record->description) }}</textarea>
        </x-field>

        <x-field label="Notify This Email" for="notify_email" hint="Each submission is emailed here." :error="$errors->first('notify_email')">
            <x-input id="notify_email" name="notify_email" type="email" :value="old('notify_email', $record->notify_email)" />
        </x-field>

        <x-field label="Thank You Message" for="success_message" :error="$errors->first('success_message')">
            <x-input id="success_message" name="success_message" :value="old('success_message', $record->success_message)" />
        </x-field>

        <div class="min-w-0 sm:col-span-2 space-y-4">
            <x-toggle name="store_submissions" :checked="old('store_submissions', $record->store_submissions ?? true)"
                      label="Store Submissions In The Panel"
                      description="Turn off for forms that only need to be emailed." />
            <x-toggle name="is_published" :checked="old('is_published', $record->is_published ?? true)"
                      label="Form Is Live On The Public Site" />
        </div>
    </div>
</x-card>

<x-card title="Fields" subtitle="Add the questions this form asks. Field keys are generated from the labels.">
    <div x-data="{
            fields: @js(old('fields', $record->builderRows())),
            add() { this.fields.push({ label: '', type: 'text', required: false, help: '', options: '' }); },
            remove(i) { this.fields.splice(i, 1); },
            move(i, d) {
                const j = i + d;
                if (j < 0 || j >= this.fields.length) return;
                const t = this.fields[i]; this.fields[i] = this.fields[j]; this.fields[j] = t;
            },
            needsOptions(type) { return ['select', 'radio'].includes(type); }
         }">
        <template x-if="fields.length === 0">
            <p class="rounded-lg bg-slate-50 px-4 py-6 text-center text-sm text-slate-500">This Form Has No Fields Yet.</p>
        </template>

        <div class="space-y-4">
            <template x-for="(field, index) in fields" :key="index">
                <div class="rounded-xl ring-1 ring-slate-200 bg-slate-50/60 p-4">
                    <div class="flex items-center justify-between gap-3 pb-3">
                        <span class="text-xs font-semibold uppercase tracking-wide text-slate-400">
                            Field <span x-text="index + 1"></span>
                        </span>
                        <div class="flex items-center gap-1">
                            <button type="button" @click="move(index, -1)" data-tip="Move Up" aria-label="Move Field Up"
                                    class="inline-flex h-8 w-8 items-center justify-center rounded-lg text-slate-500 hover:bg-white transition">
                                <x-icon name="chevron-up" class="w-4 h-4" />
                            </button>
                            <button type="button" @click="move(index, 1)" data-tip="Move Down" aria-label="Move Field Down"
                                    class="inline-flex h-8 w-8 items-center justify-center rounded-lg text-slate-500 hover:bg-white transition">
                                <x-icon name="chevron-down" class="w-4 h-4" />
                            </button>
                            <button type="button" @click="remove(index)" data-tip="Remove Field" aria-label="Remove Field"
                                    class="inline-flex h-8 w-8 items-center justify-center rounded-lg text-rose-500 hover:bg-rose-50 transition">
                                <x-icon name="trash" class="w-4 h-4" />
                            </button>
                        </div>
                    </div>

                    <div class="grid gap-4 sm:grid-cols-2">
                        <div>
                            <label class="block text-sm font-medium text-slate-700" :for="`field-label-${index}`">Question Label</label>
                            <input type="text" :id="`field-label-${index}`" :name="`fields[${index}][label]`" x-model="field.label"
                                   class="mt-1.5 block w-full rounded-lg border-0 py-2 px-3 text-sm text-slate-900 ring-1 ring-inset ring-slate-300 focus:ring-2 focus:ring-brand-600">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-slate-700" :for="`field-type-${index}`">Answer Type</label>
                            <select :id="`field-type-${index}`" :name="`fields[${index}][type]`" x-model="field.type"
                                    class="mt-1.5 block w-full rounded-lg border-0 py-2 px-3 text-sm text-slate-900 ring-1 ring-inset ring-slate-300 focus:ring-2 focus:ring-brand-600">
                                @foreach ($fieldTypes as $value => $typeLabel)
                                    <option value="{{ $value }}">{{ $typeLabel }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="min-w-0 sm:col-span-2" x-show="needsOptions(field.type)" x-cloak>
                            <label class="block text-sm font-medium text-slate-700" :for="`field-options-${index}`">Choices</label>
                            <textarea :id="`field-options-${index}`" :name="`fields[${index}][options]`" x-model="field.options" rows="3"
                                      class="mt-1.5 block w-full rounded-lg border-0 py-2 px-3 text-sm text-slate-900 ring-1 ring-inset ring-slate-300 focus:ring-2 focus:ring-brand-600"></textarea>
                            <p class="mt-1 text-xs text-slate-500">One Choice Per Line.</p>
                        </div>
                        <div class="min-w-0 sm:col-span-2">
                            <label class="block text-sm font-medium text-slate-700" :for="`field-help-${index}`">Help Text</label>
                            <input type="text" :id="`field-help-${index}`" :name="`fields[${index}][help]`" x-model="field.help"
                                   class="mt-1.5 block w-full rounded-lg border-0 py-2 px-3 text-sm text-slate-900 ring-1 ring-inset ring-slate-300 focus:ring-2 focus:ring-brand-600">
                        </div>
                        <div class="min-w-0 sm:col-span-2">
                            <label class="flex items-start gap-3 cursor-pointer select-none">
                                <input type="hidden" :name="`fields[${index}][required]`" :value="field.required ? 1 : 0">
                                <button type="button" role="switch" :aria-checked="field.required.toString()"
                                        @click="field.required = ! field.required"
                                        :class="field.required ? 'bg-brand-600' : 'bg-slate-300'"
                                        class="relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors">
                                    <span :class="field.required ? 'translate-x-6' : 'translate-x-1'"
                                          class="inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform"></span>
                                </button>
                                <span class="text-sm font-medium text-slate-900">Answer Is Required</span>
                            </label>
                        </div>
                    </div>
                </div>
            </template>
        </div>

        <div class="section-divider mt-5 pt-5">
            <x-button type="button" variant="secondary" icon="plus" x-on:click="add()">Add A Field</x-button>
        </div>
    </div>
</x-card>

Blade In One Screen

The directives you will use most.

{{ $variable }}
Print a value, escaped. Safe by default.
{!! $html !!}
Print raw HTML. Only for content you trust.
@if / @else / @endif
Show something conditionally.
@foreach / @endforeach
Loop over a collection.
<x-card>
Use a shared component. Every component in Shared Components is available.
{{-- comment --}}
A comment that never reaches the browser.

House Rules

Follow these and your edits will survive updates.

  • Never start line 1 with @php. Blade mis-parses it and the page fails. The editor refuses to save it.
  • Keep logic out of templates. If you need a calculation, it belongs in a composer or component class, not here.
  • The shipped file is never modified. Reset To Default always gets you back.
  • Every save is versioned. You can revert to any earlier version in one click.
  • Press Tab inside the editor to indent rather than jump to the next field.