public function action_confirm($id = null)
 {
     is_null($id) and Response::redirect('payment');
     if ($payment = Model_Payment::find($id)) {
         $payment->status = 3;
         $payment->save();
         $money = Model_Money::forge(array('user_id' => $payment->user_id, 'title' => "buff_add", 'value' => $payment->buff_amount, 'status' => 1, 'created_at' => time()));
         $money->save();
         Session::set_flash('success', 'อนุมัติรายการชำระเงิน #' . $id . " แล้ว");
     } else {
         Session::set_flash('error', 'ไม่สามารถอนุมัติรายการชำระเงิน #' . $id . " ได้");
     }
     Response::redirect('payment');
 }
Exemple #2
0
 public static function get_moneys($user_id, $object = false)
 {
     if (!$user_id) {
         return null;
     }
     $query = DB::select('*')->from('moneys')->where('user_id', '=', $user_id)->execute()->as_array();
     if ($object) {
         $result = array();
         foreach ($query as $q) {
             $money = Model_Money::find($q['id']);
             $result[] = $money;
         }
         return $result;
     } else {
         return $query;
     }
 }