custom fields


@if(count($flight->field_values)) @endif @php # # A little nasty having logic like this in a template, but we need # to filter out the field values that have already been shown, since # they were values set because they had a FlightField parent # $shown = []; @endphp @foreach($flight_fields->concat($flight->field_values) as $field) @php if(in_array($field->name, $shown, true)) { continue; } $shown[] = $field->name; $val_field = $flight->field_values->where('name', $field->name)->first(); @endphp @endforeach
Name Value
{{ $field->name }} {{ $val_field['value'] ?? '' }} {{ Form::open(['url' => '/admin/flights/'.$flight->id.'/fields', 'method' => 'delete', 'class' => 'pjax_form pjax_flight_fields' ]) }} {{ Form::hidden('field_id', $val_field['id'] ?? null) }}
{{ Form::button('', ['type' => 'submit', 'class' => 'btn btn-sm btn-danger btn-icon', 'onclick' => "return confirm('Are you sure?')"]) }}
{{ Form::close() }}

{{ Form::open([ 'url' => '/admin/flights/'.$flight->id.'/fields', 'method' => 'post', 'class' => 'pjax_form form-inline pjax_flight_fields' ]) }} {{ Form::label('name', 'Name:') }} {{ Form::text('name', null, ['class' => 'form-control']) }}    {{ Form::label('value', 'Value:') }} {{ Form::text('value', null, ['class' => 'form-control']) }}    {{ Form::button(' add', ['type' => 'submit', 'class' => 'btn btn-success btn-s']) }}

{{ $errors->first('name') }}

{{ $errors->first('value') }}

{{ Form::close() }}