public function bets() { $param = Input::only('account_id', 'bets'); $rules = array('bets' => 'required|numeric|min:1,max:1000000', 'account_id' => 'required|exists:acl_users,id'); //custom error messaging $messages = array('buyer_id.exists' => 'Buyer id is not valid.', 'merchant_id.exists' => 'Merchant id is not valid'); $validator = Validator::make($param, $rules, $messages); if ($validator->passes()) { $points_conversion = Settings::getSettingValue('points_conversion'); $points_converted = $param['bets'] / floatval($points_conversion); $create = array('account_id' => $param['account_id'], 'added_by' => $this->operator_id, 'bet' => $param['bets'], 'points_conversation' => floatval($points_conversion), 'points_converted' => $points_converted); try { $player_bet = Playerbets::create($create); $retrieve = Points::where('account_id', $param['account_id'])->first(); $update = $retrieve->increment('credits', $points_converted); $message = 'Points has been updated.'; return Redirect::action('points.player')->with('success', $message); } catch (Exception $e) { // return false; print $e; } } else { $messages = $validator->messages(); return Redirect::action('points.player')->with('error', $messages->all()); } }
public function bets() { if (ACL::checkUserPermission('reports.bets') == false) { return Redirect::action('dashboard'); } $bets = Playerbets::with('playerdetails', 'operator')->get(); $title = 'Player Bets Report'; $data = array('acl' => ACL::buildACL(), 'bets' => $bets, 'title' => $title); return View::make('reports/bets', $data); }