Howtogiveanupdateonthebankincasetheid=54updatingtheradioinputsmeetwithvalue=a/buywithvalue=c.
Note:
Thisisapurchaserequisitionmadebytheuser,Iwouldliketogive anupdateonlyinthefieldservedaccordingtoinputradio above.
@foreach($detalhesas$detalhe)<tr><td><divclass="col-xs-6">
Atender <input type="radio" name="atendecompra[{{ print $i}}]" value="a" checked="true">
</div>
<div class="col-xs-6">
Comprar<input type="radio" name="atendecompra[{{ print $i}}]" value="c">
</div>
</td>
</tr>
<?php $i++;?>
@endforeach
Controllher
public function update(Request $request, $id){
$idproduto=$request->get('idproduto');
$atendecompra=$request->get('atendecompra');
$cont = 0;
while($cont < count($idproduto)){
$detalhe = new RequisicaoDet();
$detalhe->idrequisicao=$id;
$detalhe->atendecompra=String($atendecompra)[$cont];
$detalhe->update();
$cont=$cont+1;
}
return Redirect::to('almoxarifado/requisicao');
}
Model
class RequisicaoDet extends Model
{
protected $table ='requisicaodet';
protected $primaryKey ='idrequisicaodet';
public $timestamps =false;
protected$fillable =[
'idrequisicao',
'idproduto',
'qnt',
'detalhe',
'idcentrocusto',
'atendecompra'
];
protected $guarded =[];
}