Example #1
0
 /**
  * Update child item
  *
  * @param  int,int 
  */
 public function updateChildrates($input)
 {
     $rates = Rates::all();
     $i = 0;
     foreach ($rates as $rate) {
         $rates[$i]->rates_info = $input['rates_info'][$i];
         $rates[$i]->rates_price = $input['rates_price'][$i];
         $rates[$i]->rates_order = $i;
         $rate->save();
         $i++;
     }
 }
Example #2
0
 public function save($id = null)
 {
     $user = Session::read('member');
     if ($user == "") {
         return $this->redirect('/');
     }
     //			$id = 		md5($user['email']);
     if ($id != "") {
         $data = array("Saved" => "Yes");
         $conditions = array('_id' => $id);
         Documents::update($data, $conditions);
         $this->redirect("ex::dashboard");
     }
     $detail = Details::find('first', array('conditions' => array('user_id' => (string) $user['_id'])));
     $option = 'fileType';
     $document = Documents::find('first', array('conditions' => array('details_doc_id' => (string) $detail['_id'], 'Saved' => null)));
     $rates = Rates::find('first', array('conditions' => array('Min' => array('$lte' => intval($document['document']['Pages'])), 'Max' => array('$gte' => intval($document['document']['Pages'])))));
     return compact('document', 'rates');
 }