@extends('layouts.admin') @section('title', ($record ? 'Edit ' : 'Add ').$definition['singular']) @section('page-title', $definition['title']) @section('content')
{{ $record ? 'Edit record' : 'New record' }}

{{ $record ? 'Edit '.$definition['singular'] : 'Add '.$definition['singular'] }}

Complete the fields below and save your changes.

← Back to {{ strtolower($definition['title']) }}
@if($errors->any())
Please correct the following:
@endif
@csrf @if($record) @method('PUT') @endif
@foreach($definition['fields'] as $name => $field) @php $raw = old($name); if ($raw === null && $record) { if ($name === 'role' && method_exists($record, 'getRoleNames')) $raw = $record->getRoleNames()->first(); elseif ($name === 'filters' && is_array($record->filters ?? null)) $raw = json_encode($record->filters, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); else $raw = data_get($record, $name); } if ($raw instanceof \Carbon\CarbonInterface && ($field['type'] ?? '') === 'datetime-local') $raw = $raw->format('Y-m-d\TH:i'); if ($raw instanceof \Carbon\CarbonInterface && ($field['type'] ?? '') === 'date') $raw = $raw->format('Y-m-d'); @endphp @if(($field['type'] ?? 'text') === 'checkbox') @else @endif @endforeach
Cancel
@endsection