Bitte dieses Bild überprüfen werden Sie Idee bekommen, was ich brauche LINK i viele Flug zu einem Transport einfügen wollen, aber ich will wählen Personen für Transporte und Flüge alles funktioniert perfekt aber für die flugdetails wenn ich zwei personen im ersten flug zwei personen im zweiten flug in meiner pivot-tabelle auswähle, wählen sie den aufsteigenden 4 personennamen in beiden flight deatils aus. check this linkUpdate Pivot-Tabelle mit dynamischer Formulareingabe mit foreach Schleife
i einfügen möchten Personen separte wie erste Flug deatils zwei Personen und zweiten Flugdaten nennen zwei Personen so ist dies mein Controller
$data = array();
$origin = $request->get('origin');
$destination = $request->get('destination');
$flight_no = $request->flight_no;
$dep_date = $request->dep_date;
$arrival_date = $request->arrival_date;
foreach ($origin as $key => $value){
$data[] = [
'transport_id' => $new->id,
'origin' => $value,
'destination' =>$destination[$key],
'flight_no' =>$flight_no[$key],
'dep_date' =>Carbon::parse($dep_date[$key])->format('Y-m-d h:i'),
'arrival_date'=> Carbon::parse($arrival_date[$key])->format('Y-m-d h:i'),
'user_id'=> Auth::id()
];
}
foreach($data as $d){
$flight = Flight::create($d);
$flight->crews()->attach($request->input('flight_crew_list'));
}
Wie kann ich? wenn nicht klar, was Sie brauchen, um mir zu helfen? EDIT: Meine Form wie diese im Hinzufügen von dynamischer Flugform mit VueJs
<tr v-for="row in rows">
<td>
<ul>
@foreach($crew_id as $key => $name)
<li> {!! Form::checkbox('flight_crew_list[]', $key) !!}
<b> {!! strtoupper($name) !!} </b>: ({{ $crew_type[$key] }})</li>
@endforeach
</ul>
</td>
<td>
<div class="row col-md-offset-1">
<div class="col-md-4">
{!! Form::label('origin', 'Origin',['class'=>'control-label']) !!}
</div>
<div class="col-md-8">
{!! Form::text('origin[]',null,['class' => 'input-field input-sm text-upper',]) !!}
</div>
</div>
<div class="row col-md-offset-1">
<div class="col-md-4">
{!! Form::label('destination', 'Destination',['class'=>'control-label']) !!}
</div>
<div class="col-md-8">
{!! Form::text('destination[]',null,['class' => 'input-field input-sm text-upper']) !!}
</div>
</div>
<div class="row col-md-offset-1">
<div class="col-md-4">
{!! Form::label('flight_no', 'Flight No',['class'=>'control-label']) !!}
</div>
<div class="col-md-8">
{!! Form::text('flight_no[]',null,['class' => 'input-field input-sm text-upper']) !!}
</div>
</div>
<div class="row col-md-offset-1">
<div class="col-md-4">
{!! Form::label('datetime3', 'Departure',['class'=>'control-label']) !!}
</div>
<div class="col-md-8">
{!! Form::text('dep_date[]',null,['class' => 'input-field input-sm','id'=>'datetime3']) !!}
</div>
</div>
<div class="row col-md-offset-1">
<div class="col-md-4">
{!! Form::label('datetime4', 'Arrival Date',['class'=>'control-label']) !!}
</div>
<div class="col-md-8">
{!! Form::text('arrival_date[]',null,['class' => 'input-field input-sm','id'=>'datetime4']) !!}
</div>
</div>
</td>
<td>
<a @click="removeRow(row)">
<button class="btn btn-xs " type="button" id="dim">
<span class="glyphicon glyphicon-minus"></span>
</button>
</a>
</td>
</tr>
meine Frage Chek – Developer
hey thnks aber im Hinzufügen von Zeilen mit ** vue-js ** im Problem konfrontiert, dass passieren ** $ row_id ** – Developer
ich weiß, wie $ bekommt row_id wie diese '@ {{ $ index}} 'Ich kann die ID bekommen, aber wie geht es? irgendeine Idee ? – Developer