Ejemplo n.º 1
0
 public function destroy($id)
 {
     $client = CommissionsRage::find($id);
     $client->delete();
     return;
 }
Ejemplo n.º 2
0
 public function update($id)
 {
     $commission = Commission::find($id);
     $commission->nds = Input::get('nds');
     $commission->deduction = Input::get('deduction');
     $commission->payer = Input::get('payer');
     $commission->additional_sum = Input::get('additional_sum');
     $commission->rate_stitching = Input::get('rate_stitching');
     $commission->time_of_settlement = Input::get('time_of_settlement');
     if (null !== Input::get('commission_value')) {
         $commission->commission_value = Input::get('commission_value');
     }
     $commission->save();
     if (null !== Input::get('range_commission_value')) {
         foreach (Input::get('range_commission_value') as $key => $range_commission_value) {
             if ("" !== Input::get('range_commission_id')[$key]) {
                 $commissions_rage = CommissionsRage::find(Input::get('range_commission_id')[$key]);
             } else {
                 $commissions_rage = new CommissionsRage();
             }
             if ('' !== Input::get('range_commission_min')[$key]) {
                 $commissions_rage->min = Input::get('range_commission_min')[$key];
             }
             if ('' !== Input::get('range_commission_max')[$key]) {
                 $commissions_rage->max = Input::get('range_commission_max')[$key];
             }
             $commissions_rage->value = Input::get('range_commission_value')[$key];
             $commissions_rage->commission_id = $commission->id;
             $commissions_rage->save();
         }
     }
     // redirect
     return response()->json($commission->tariff_id);
 }