コード例 #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $qty = $this->ask('How Many Cycle Each Card Line Do You Want for [ RANDOM BOOSTER ] ?!');
     if ($this->confirm('Do you wish to continue? [y|N]')) {
         $this->output->progressStart($qty);
         $faker = Faker\Factory::create();
         $u = $qty;
         $i = 0;
         $t = 0;
         $jk = 0;
         $q = 0;
         $k = 0;
         $a = 0;
         $ten = Ten::where('active', true)->where('shuffle', false)->lists('link_id')->toArray();
         $jack = Jack::where('active', true)->where('shuffle', false)->lists('link_id')->toArray();
         $queen = Queen::where('active', true)->where('shuffle', false)->lists('link_id')->toArray();
         $king = King::where('active', true)->where('shuffle', false)->lists('link_id')->toArray();
         $ace = Ace::where('active', true)->where('shuffle', false)->lists('link_id')->toArray();
         while ($i < $u) {
             try {
                 $this->ten->randomCycle($faker->randomElement($ten));
             } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $exception) {
                 $t++;
             }
             try {
                 $this->jack->randomCycle($faker->randomElement($jack));
             } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $exception) {
                 $jk++;
             }
             try {
                 $this->queen->randomCycle($faker->randomElement($queen));
             } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $exception) {
                 $q++;
             }
             try {
                 $this->king->randomCycle($faker->randomElement($king));
             } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $exception) {
                 $k++;
             }
             try {
                 $this->ace->randomCycle($faker->randomElement($ace));
             } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $exception) {
                 $a++;
             }
             $i++;
             $this->output->progressAdvance();
         }
         $headers = ['Total Random Booster', 'Booster Distributed', 'Ten Failed', 'Jack Failed', 'Queen Failed', 'King Failed', 'Ace Failed'];
         $rows = [["total" => $u * 5, "consumed" => $u * 5 - ($t + $jk + $q + $k + $a), "ten" => $t, "jack" => $jk, "queen" => $q, "king" => $k, "ace" => $a]];
         $this->output->progressFinish();
         $this->table($headers, $rows);
     }
 }
コード例 #2
0
ファイル: CardTrait.php プロジェクト: xenxa/royalflushnetwork
 public function switchToQueen($lid)
 {
     if (new static() != new Queen()) {
         $card = static::where('link_id', $lid)->where('shuffle', false)->where('min_direct', '>', $this->min_queen)->where('canSwitch', true)->first();
         $cardID = $card->id;
         $directCount = $card->min_direct;
         $card->delete();
         $cardline = Cardline::where('card_type', $this->cardtype)->where('card_id', $cardID)->delete();
         $card = new Queen();
         $card->link_id = $lid;
         $card->min_direct = $directCount;
         $card->save();
         $cardline = new Cardline();
         $cardline->link_id = $lid;
         $card->cardpoints()->save($cardline);
         return "You  Switch to Card Line Queen!";
     }
     return "You  Cant Switch Line!";
 }