예제 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     //$faker->addProvider(new Faker\Provider\DateTime($faker));
     $data = CombatRound::where('challenge_id', '=', 5)->get();
     foreach ($data as $d) {
         $time1 = DateTime::time($format = 'H:i:s', $max = '00:02:00');
         $time2 = DateTime::time($format = 'H:i:s', $max = '00:02:00');
         $zonaRoja1 = $faker->numberBetween($min = 2, $max = 5);
         $nZonaRojo1 = $zonaRoja1 + 1;
         $zonaVerde1 = $faker->numberBetween($min = 1, $max = 5);
         $nZonaVerde1 = $zonaVerde1 + 1;
         $zonaAzul1 = $faker->numberBetween($min = 2, $max = 5);
         $nZonaAzul1 = $zonaAzul1 + 1;
         $zonaRoja2 = $faker->numberBetween($min = 2, $max = 5);
         $nZonaRojo2 = $zonaRoja2 + 1;
         $zonaVerde2 = $faker->numberBetween($min = 1, $max = 5);
         $nZonaVerde2 = $zonaVerde2 + 1;
         $zonaAzul2 = $faker->numberBetween($min = 2, $max = 5);
         $nZonaAzul2 = $zonaAzul2 + 1;
         BlockRise::create(['combat_id' => $d['id'], 'team_id_1' => $d['versus_one'], 'time_team_1' => $time1, 'zon_pun_roj_1' => $zonaRoja1, 'num_api_roj_1' => $nZonaRojo1, 'zon_pun_ver_1' => $zonaVerde1, 'num_api_ver_1' => $nZonaVerde1, 'zon_pun_azu_1' => $zonaAzul1, 'num_api_azu_1' => $nZonaAzul1, 'team_id_2' => $d['versus_two'], 'time_team_2' => $time2, 'zon_pun_roj_2' => $zonaRoja2, 'num_api_roj_2' => $nZonaRojo2, 'zon_pun_ver_2' => $zonaVerde2, 'num_api_ver_2' => $nZonaVerde2, 'zon_pun_azu_2' => $zonaAzul2, 'num_api_azu_2' => $nZonaAzul2]);
     }
 }
 public function getInfoBlock(Request $request)
 {
     //dd($request->all());
     $data = BlockRise::where('combat_id', '=', $request->combat_id)->first();
     $array = [];
     $true = false;
     if ($request->identificador == 2) {
         $array += ['time' => $data->time_team_2, 'zona_1' => $data->zon_pun_roj_2, 'num_1' => $data->num_api_roj_2, 'zona_2' => $data->zon_pun_ver_2, 'num_2' => $data->num_api_ver_2, 'zona_3' => $data->zon_pun_azu_2, 'num_3' => $data->num_api_azu_2, 'score' => $data->scort_team_2];
         $true = true;
     } else {
         $array += ['time' => $data->time_team_1, 'zona_1' => $data->zon_pun_roj_1, 'num_1' => $data->num_api_roj_1, 'zona_2' => $data->zon_pun_ver_1, 'num_2' => $data->num_api_ver_1, 'zona_3' => $data->zon_pun_azu_1, 'num_3' => $data->num_api_azu_1, 'score' => $data->scort_team_1];
         $true = true;
     }
     return ['data' => $array, 'flag' => $true];
     /*
      *  'team_id_1',
     'time_team_1',
     'zon_pun_roj_1',
     'num_api_roj_1',
     'zon_pun_ver_1',
     'num_api_ver_1',
     'zon_pun_azu_1',
     'num_api_azu_1',
     'scort_team_1',
     'team_id_2',
     'time_team_2',
     'zon_pun_roj_2',
     'num_api_roj_2',
     'zon_pun_ver_2',
     'num_api_ver_2',
     'zon_pun_azu_2',
     'num_api_azu_2',
     'scort_team_2',
     'firm_team_2',
     'firm_team_1']
     */
 }