我需要在数据库中插入很多一行,任何一行都可以帮助我 这是代码
$commitee = Committee::create($request->all());
$now = Carbon::now()->toDateTimeString();
$data = [
[
'committee_id' => $commitee->id, 'user_id' => $request->input('manager'), 'member_type_id' => 1, 'created_by_user_id' => $request->user()->user_id, 'created_at' => $now,
'updated_at' => $now
],
[
'committee_id' => $commitee->id, 'user_id' => $request->input('vice'), 'member_type_id' => 2, 'created_by_user_id' => $request->user()->user_id, 'created_at' => $now,
'updated_at' => $now
]
];
$ input = Input :: all(); foreach($ input作为$ member) { $ items =新的CommitteeMember([ 'committee_id'=> $ committee-> id, 'user_id'=> $ member ['members'], 'member_type_id'=> 3, 'created_by_user_id'=> $现在, 'updated_at'=> $现在, ]); $ items-> saveMany(); }
CommitteeMember::insert($data);
<select name="members" id="committee_members" class="input-group-prepend select2">
<option value="0">اختر</option>
@foreach($employees as $key => $name)
<option value="{{ $name->user_id }}">{{ $name->user_name }}</option>
@endforeach
</select>
<select name="" id="" hidden>
<option value="3" hidden>رئيس</option>
</select>
//图像 only the third table has multi rows`
提前谢谢...
答案 0 :(得分:0)
您可能需要Committee::insert($data);