コード例 #1
0
 public function winnings()
 {
     if (ACL::checkUserPermission('reports.winnings') == false) {
         return Redirect::action('dashboard');
     }
     $game_winnings = Gamewinnings::with('channel.tabledetails.operator')->get();
     $title = Lang::get('Winning Numbers');
     $data = array('acl' => ACL::buildACL(), 'winnings' => $game_winnings, 'title' => $title);
     return View::make('reports/winnings', $data);
 }
コード例 #2
0
 public function player()
 {
     if (ACL::checkUserPermission('points.player') == false) {
         return Redirect::action('dashboard');
     }
     $form_open = Form::open(array('method' => 'post', 'files' => true, 'id' => 'form-player-csv', 'class' => 'smart-form', 'role' => 'form'));
     $userList = UserMember::with('user', 'group', 'points')->where('group_id', 4)->get();
     $title = Lang::get('Player List');
     $client_ip = Request::getClientIp(true);
     $data = array('acl' => ACL::buildACL(), 'userList' => $userList, 'title' => $title, 'form_open' => $form_open, 'client_ip' => $client_ip);
     return View::make('points/index', $data);
 }
コード例 #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     if (ACL::checkUserPermission('bet.roulette') == false) {
         return Redirect::action('dashboard');
     }
     $param = Input::only('bettype', 'betnumber', 'amount', 'game_id');
     $retrieve = Wallet::where('account_id', Auth::user()->id)->first();
     $bet_type = array('straight', 'split', 'line', 'square', 'basket', 'doublestreet');
     if ($retrieve->credits >= $param['amount']) {
         if (Input::has('betnumber')) {
             if (count($param['betnumber']) >= 0 && count($param['betnumber']) <= 6) {
                 $retrieve = Wallet::where('account_id', Auth::user()->id)->first();
                 $index = count($param['betnumber']) - 1;
                 try {
                     $update = $retrieve->decrement('credits', (double) $param['amount']);
                     $fundinout = array('wallet_id' => $retrieve->id, 'onbehalf' => Auth::user()->id, 'credits' => $param['amount'], 'description' => 'Bet on Roulette amount of $' . (double) $param['amount'], 'fundtype' => 'bet');
                     $fundout = Fundinout::create($fundinout);
                     $bet = array('player_id' => Auth::user()->id, 'channel_id' => $param['game_id'], 'bet_number' => implode(',', $param['betnumber']), 'bet_amount' => $param['amount'], 'bet_type' => $bet_type[$index]);
                     Gamebets::create($bet);
                     $message = 'Bet has been successfully place.';
                     return Redirect::action('bet.roulette')->with('success', $message);
                 } catch (Exception $e) {
                     return false;
                 }
             } else {
                 return Redirect::action('bet.roulette')->with('error', 'You can only place maximum of 6 number.');
             }
         }
         if (Input::has('bettype')) {
             $param = Input::only('bettype', 'amount', 'game_id');
             $retrieve = Wallet::where('account_id', Auth::user()->id)->first();
             try {
                 $update = $retrieve->decrement('credits', (double) $param['amount']);
                 $fundinout = array('wallet_id' => $retrieve->id, 'onbehalf' => Auth::user()->id, 'credits' => $param['amount'], 'description' => 'Bet on Roulette amount of $' . (double) $param['amount'], 'fundtype' => 'bet');
                 $fundout = Fundinout::create($fundinout);
                 $bet = array('player_id' => Auth::user()->id, 'channel_id' => $param['game_id'], 'bet_number' => $param['bettype'], 'bet_amount' => $param['amount'], 'bet_type' => $param['bettype']);
                 Gamebets::create($bet);
                 $message = 'Bet has been successfully place.';
                 return Redirect::action('bet.roulette')->with('success', $message);
             } catch (Exception $e) {
                 return false;
             }
         }
     } else {
         return Redirect::action('bet.roulette')->with('error', 'Insufficient credits!');
     }
 }
コード例 #4
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     if (ACL::checkUserPermission('settings.index') == false) {
         return Redirect::action('dashboard');
     }
     $settings = Settings::where('id', $id)->find($id);
     $settings->display_name = Input::get('display_name');
     $settings->value = Input::get('value');
     $settings->updated_at = date('Y-m-d H:i:s');
     if ($settings->save()) {
         $messageType = 'success';
         $message = 'Setting edit success';
     } else {
         $messageType = 'error';
         $message = 'Setting edit failed';
     }
     return Redirect::action('settings.index')->with($messageType, $message);
 }
コード例 #5
0
 public function edit($id)
 {
     if (ACL::checkUserPermission('games.edit') == false) {
         return Redirect::action('dashboard');
     }
     $title = Lang::get('Roulette Table');
     $formOpen = Form::open(array('method' => 'put', 'id' => 'form-group', 'class' => 'smart-form', 'route' => array('games.update', $id)));
     $formClose = Form::close();
     $operators = Usermember::with('group', 'user')->where('group_id', 3)->get();
     $tabledetails = Gametables::find($id);
     if (!empty($tabledetails)) {
         $data = array('title' => $title, 'operators' => $operators, 'tabledetails' => $tabledetails, 'formOpen' => $formOpen, 'formClose' => $formClose);
         return View::make('games/edit', $data);
     } else {
         $message = 'Cannot find roulette game table.';
         return Redirect::action('games.index')->with('error', $message);
     }
 }
コード例 #6
0
 public function start()
 {
     if (ACL::checkUserPermission('roulette.start') == false) {
         return Redirect::action('dashboard');
     }
     if (Auth::user()->isOperator()) {
         $game = Games::where('game_name', 'Roulette')->take(1)->get()->first();
         $table = Gametables::where('operator_id', $this->operator_id)->take(1)->get()->first();
         $players = Playeroperators::with('playerdetails', 'credits')->where('operator_id', $this->operator_id)->get();
         if (!empty($table)) {
             $create_channel = array('channel_id' => Utils::generateRandomString(), 'table_id' => $table->id);
             $channel_id = '';
             $channel = Gamechannel::openchannel()->where('table_id', $table->id)->take(1)->get()->first();
             if (!empty($channel)) {
                 $channel_id = $channel->id;
             } else {
                 $channel_create = Gamechannel::create($create_channel);
                 $channel_id = $channel_create->id;
             }
             $gamedetails = Gamechannel::with('tabledetails.gamedetails', 'tabledetails.operator', 'bets', 'bets.playerdetails')->find($channel_id);
             $totalbets = 0;
             $totalplayers = 0;
             if ($gamedetails->bets != null) {
                 foreach ($gamedetails->bets as $gamebets) {
                     $totalbets += $gamebets->bet_amount;
                     $totalplayers++;
                 }
             }
             $title = Lang::get('Start Game');
             $data = array('title' => $title, 'totalbets' => $totalbets, 'totalplayers' => $totalplayers, 'gamedetails' => $gamedetails, 'players' => $players);
             return View::make('operator/create', $data);
         } else {
             return App::abort(401, 'No Roulette table has been assigned to your account.');
         }
     } else {
         return App::abort(401, 'You are not a operator.');
     }
 }
コード例 #7
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     if (ACL::checkUserPermission('player.edit') == false) {
         return Redirect::action('dashboard');
     }
     $player_info = User::find($id);
     if (!empty($player_info)) {
         $title = Lang::get('Edit Player Details');
         $form_open = Form::open(array('method' => 'put', 'id' => 'form-player', 'class' => 'smart-form', 'route' => array('player.update', $id)));
         $form_close = Form::close();
         $data = array('form_open' => $form_open, 'form_close' => $form_close, 'title' => $title, 'url_rfid' => URL::route('player.rfid'), 'player_info' => $player_info);
         return View::make('player/edit', $data);
     } else {
         $message = 'Cannot get player info. Please try again.';
         return Redirect::Action('player.index')->with('error', $message);
     }
 }
コード例 #8
0
 public function updatePermission()
 {
     if (ACL::checkUserPermission('groups.edit') == false) {
         return Redirect::action('dashboard');
     }
     if (Input::has('permission')) {
         $permission = Input::get('permission');
         foreach ($permission as $key => $value) {
             ACL::saveGroupPermission($key, $value);
         }
     }
     $messageType = 'success';
     $message = 'Group edit permission success';
     return Redirect::action('settings.groups')->with($messageType, $message);
 }
コード例 #9
0
 public function updatepermission($id)
 {
     if (ACL::checkUserPermission('user.permission') == false) {
         return Redirect::action('dashboard');
     }
     if (Input::has('permission')) {
         $permission = Input::get('permission');
         $userpermission = ACL::saveUserPermission($id, $permission);
     } else {
         UserPermissions::where('user_id', '=', $id)->delete();
     }
     $message = 'User Permission has been modified';
     return Redirect::action('')->with('success', $message);
 }
コード例 #10
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (ACL::checkUserPermission('permission.delete') == false) {
         return Redirect::action('dashboard');
     }
     $permission = Permission::where('id', $id)->find($id);
     if (!empty($permission)) {
         $permission->delete();
         $messageType = 'success';
         $message = 'Permission delete success';
     } else {
         $messageType = 'error';
         $message = 'Permission delete failed';
     }
     return Redirect::action('settings.permission')->with($messageType, $message);
 }