【发布时间】:2020-01-31 11:50:31
【问题描述】:
如何获取 id,然后将 v-text 的值保存在表格中
我想将malla_curricular 表的id 保存在idMalla 字段中,并将字段pAcademicoInicio cicloLectivoInicio 的值保存在表periodoLectivoMallaOrigen 的字段periodoLectivoMallaOrigen 中
<Label>Seleccione el periodo de la malla</Label>
<select v-model="idMalla" class="form-control col-md-12">
<option v-for="malla in arrayPeriodo" :key="malla.id" :value="malla.id" v-text="malla.pAcademicoInicio + ' - ' + malla.cicloLectivoInicio">
</option>
vue方法在这里我不知道如何获取值以将它们发送到另一个表
EventSubir(){
let me = this;
axios.post('/estudioreingresomat/registrar',{
'id': this.id,
'idMalla': this.idMalla,
'periodoLectivoMallaOrigen': this.periodoLectivoMallaOrigen,
'periodoLectivoMallRediseñada': this.periodoLectivoMallRediseñada,
}).then(function (response) {
console.log('EXITO!!');
}).catch(function (error) {
console.log('error al ingresar el estudio!!');
console.log(error);
});
},
public function store(Request $request) {
if (!$request->ajax()) return redirect('/');
try{
DB::beginTransaction();
$estudioReingreso = new EstudioReingreso();
$estudioReingreso->idMalla = $request->idMalla;
$estudioReingreso->periodoLectivoMallaOrigen = $request->periodoLectivoMallaOrigen;
$estudioReingreso->periodoLectivoMallRediseñada = $request->periodoLectivoMallRediseñada;
$estudioReingreso->save();
session(['estudioReingreso' => $estudioReingreso->id]);
DB::commit();
} catch (Exception $e){
echo('se tosteo lpm');
DB::rollBack();
}
}
【问题讨论】: