コード例 #1
0
 public function tallySheet($type)
 {
     $bets = Auth::user()->bets()->where('type', '=', $type)->whereHas('transaction', function ($transactionQuery) {
         $startTime = Carbon::now()->hour(0)->minute(0)->second(0);
         $endTime = Carbon::now()->hour(23)->minute(59)->second(59);
         $transactionQuery->where('draw', '=', getDrawTime())->whereBetween('created_at', [$startTime, $endTime]);
     })->groupBy('bet_number')->get([DB::raw('sum(bet_amount) as bet_amount'), 'bet_number', 'id', 'type', 'user_id']);
     return $bets;
 }
コード例 #2
0
 public function create($input)
 {
     $draw = getDrawTime();
     $user = Auth::user();
     foreach ($input as $type => $amount) {
         $this->todayPrize($type, $draw)->delete();
         $prize = new Prize(['amount' => $amount, 'type' => $type, 'draw' => $draw]);
         $user->prizes()->save($prize);
     }
 }
コード例 #3
0
 /**
  * Display a listing of the resource.
  * GET /winningnumber
  *
  * @return Response
  */
 public function index()
 {
     if (Request::get('draw') != '') {
         $draw = Request::get('draw');
     } else {
         $draw = getDrawTime();
     }
     $date = Request::get('date');
     $result = $this->winningNumberRepository->getWinners('last2', $draw, $date);
     $result = $result->merge($this->winningNumberRepository->getWinners('last3', $draw, $date));
     $result = $result->merge($this->winningNumberRepository->getWinners('fourdigit', $draw, $date));
     $result = $result->merge($this->winningNumberRepository->getWinners('swertwo', $draw, $date));
     $result = $result->merge($this->winningNumberRepository->getWinners('swertres', $draw, $date));
     return $result;
 }
コード例 #4
0
 public function create($input)
 {
     if (isset($input['draw'])) {
         $draw = $input['draw'];
     } else {
         $draw = getDrawTime();
     }
     $date = $input['date'];
     unset($input['draw']);
     unset($input['date']);
     foreach ($input as $type => $winning_number) {
         $this->todayWinningNumber($type, $draw, $date)->delete();
         $winningNumber = WinningNumber::create(['bet_number' => $winning_number, 'type' => $type, 'draw' => $draw]);
         $winningNumber->created_at = $startTime = Carbon::parse($date)->hour(0)->minute(0)->second(1);
         $winningNumber->save();
     }
 }
コード例 #5
0
 public function getBetByCurrentDraw($type)
 {
     $startTime = Carbon::now()->hour(0)->minute(0)->second(0);
     $endTime = Carbon::now()->hour(23)->minute(59)->second(59);
     return Bet::where('type', '=', $type)->where('draw', '=', getDrawTime())->whereBetween('created_at', [$startTime, $endTime])->get();
 }
コード例 #6
0
 /**
  * Get todays prize by admin
  */
 public function todayPrize()
 {
     $draw = getDrawTime();
     $last2 = $this->prizeRepository->todayPrize('last2', $draw)->first();
     $last3 = $this->prizeRepository->todayPrize('last3', $draw)->first();
     $fourdigit = $this->prizeRepository->todayPrize('fourdigit', $draw)->first();
     $swertwo = $this->prizeRepository->todayPrize('swertwo', $draw)->first();
     $swertres = $this->prizeRepository->todayPrize('swertres', $draw)->first();
     return compact('last2', 'last3', 'fourdigit', 'swertwo', 'swertres');
 }
コード例 #7
0
 /**
  * Tally sheet for printing
  */
 public function tallySheetPrinting($type)
 {
     $tallySheet = $this->transactionRepository->tallySheet($type);
     $user = Auth::user();
     $draw = getDrawTime();
     $date = date('F d Y');
     return View::make('transactions.tally-sheet', compact('tallySheet', 'user', 'draw', 'date'));
 }
コード例 #8
0
 /**
  * Update the specified resource in storage.
  * PUT /bet/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $input = Input::all();
     $input['draw'] = getDrawTime();
     try {
         if ($input['type'] == 'last2') {
             $this->last2Form->validate($input);
         } elseif ($input['type'] == 'last3') {
             $this->last3Form->validate($input);
         } elseif ($input['type'] == 'fourdigit') {
             $this->fourDigitForm->validate($input);
         } elseif ($input['type'] == 'swertwo') {
             $this->swerTwoForm->validate($input);
         } elseif ($input['type'] == 'swertres') {
             $this->swerTresForm->validate($input);
         }
     } catch (Laracasts\Validation\FormValidationException $error) {
         $result = 'error';
         if ($input['type'] == 'last2') {
             $errors = $this->last2Form->getValidationErrors();
         } elseif ($input['type'] == 'last3') {
             $errors = $this->last3Form->getValidationErrors();
         } elseif ($input['type'] == 'fourdigit') {
             $errors = $this->fourDigitForm->getValidationErrors();
         } elseif ($input['type'] == 'swertwo') {
             $errors = $this->swerTwoForm->getValidationErrors();
         } elseif ($input['type'] == 'swertres') {
             $errors = $this->swerTresForm->getValidationErrors();
         }
         return compact('result', 'errors');
     }
     if ($input['type'] == 'fourdigit') {
         if (strlen($input['bet_number']) == 2) {
             $input['type'] = 'last2';
         } elseif (strlen($input['bet_number']) == 3) {
             $input['type'] = 'last3';
         } else {
             $input['type'] = 'fourdigit';
         }
     }
     if ($input['type'] == 'swertres') {
         if (strlen($input['bet_number']) == 2) {
             $input['type'] = 'swertwo';
         } else {
             $input['type'] = 'swertres';
         }
     }
     $limit = $this->betLimitRepository->byBetNumber($input['bet_number']);
     if (isset($limit)) {
         $startTime = Carbon::now()->hour(0)->minute(0)->second(0);
         $endTime = Carbon::now()->hour(23)->minute(59)->second(59);
         $total = DB::table('bets')->where('bet_number', '=', $input['bet_number'])->whereBetween('created_at', [$startTime, $endTime])->where('id', '!=', $id)->where('draw', '=', $input['draw'])->sum('bet_amount');
         $total += $input['bet_amount'];
         if ($total > $limit->bet_amount) {
             $result = 'error';
             $errors = ['bet_amount' => ['\'' . $input['bet_number'] . '\' is sold out.']];
             return compact('result', 'errors');
         }
     }
     $result = 'success';
     $bet = $this->betRepository->update($id, $input);
     return compact('result', 'bet');
 }
コード例 #9
0
ファイル: filters.php プロジェクト: anthon-alindada/gaming-88
        return '';
    } elseif ($currentDate >= strtotime(date('Y-m-d 15:45:00')) && $currentDate <= strtotime(date('Y-m-d 16:30:00'))) {
        return '';
    } elseif ($currentDate >= strtotime(date('Y-m-d 20:55:00')) && $currentDate <= strtotime(date('Y-m-d 23:59:59'))) {
        return '';
    } elseif ($currentDate >= strtotime(date('Y-m-d 00:00:01')) && $currentDate <= strtotime(date('Y-m-d 06:00:00'))) {
        return '';
    }
});
/*
|--------------------------------------------------------------------------
| Route for 9pm
|--------------------------------------------------------------------------
*/
Route::filter('9pm', function () {
    if (getDrawTime() != '9PM') {
        return '';
    }
});
/*
|--------------------------------------------------------------------------
| Draw Filter full day draw
|--------------------------------------------------------------------------
*/
Route::filter('drawday', function () {
    $currentDate = strtotime(date('Y-m-d H:i:s'));
    if ($currentDate >= strtotime(date('Y-m-d 20:55:00')) && $currentDate <= strtotime(date('Y-m-d 23:59:59'))) {
        return '';
    } elseif ($currentDate >= strtotime(date('Y-m-d 00:00:01')) && $currentDate <= strtotime(date('Y-m-d 06:00:00'))) {
        return '';
    }