public function run()
 {
     $faker = Faker\factory::create();
     DB::table('challenges')->delete();
     foreach (range(1, 5) as $index) {
         Challenge::create(['name' => $faker->word, 'description' => $faker->text($maxNbChars = 50), 'secrecy' => $faker->numberBetween($min = 1, $max = 3), 'type' => $faker->numberBetween($min = 1, $max = 2), 'admin' => $faker->numberBetween($min = 0, $max = 1), 'active' => $faker->numberBetween($min = 0, $max = 1)]);
     }
 }
Ejemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     Challenge::create(['name' => 'Sumo robotizado NXT', 'duration' => '20', 'challenge_duration' => '2', 'schedumal' => '08:00:00', 'free_time' => '30']);
     Challenge::create(['name' => 'Sumo robotizado EV3', 'duration' => '20', 'challenge_duration' => '2', 'schedumal' => '08:00:00', 'free_time' => '30']);
     Challenge::create(['name' => 'Futbol robotizado NXT', 'duration' => '20', 'challenge_duration' => '4', 'schedumal' => '08:00:00', 'free_time' => '30']);
     Challenge::create(['name' => 'Futbol robotizado EV3', 'duration' => '20', 'challenge_duration' => '4', 'schedumal' => '08:00:00', 'free_time' => '30']);
     Challenge::create(['name' => 'Blockrise', 'duration' => '20', 'challenge_duration' => '3', 'schedumal' => '08:00:00', 'free_time' => '30']);
     Challenge::create(['name' => 'Reto sorpresa', 'duration' => '20', 'challenge_duration' => '2', 'schedumal' => '08:00:00', 'free_time' => '30']);
     Challenge::create(['name' => 'Taekwondo robotizado', 'duration' => '20', 'challenge_duration' => '3', 'schedumal' => '08:00:00', 'free_time' => '30']);
     Challenge::create(['name' => 'Carrera de obstáculos', 'duration' => '20', 'challenge_duration' => '3', 'schedumal' => '08:00:00', 'free_time' => '30']);
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(Request $request)
 {
     $data = Tool::removeSpace($request->all());
     if ($data['id']) {
         $chan = Challenge::find($data['id']);
         $chan->name = $data['Nombre'];
         $chan->active = $data['Estatus'];
         $chan->duration = $data['Duración_reto'];
         $chan->schedumal = $data['Hora_inicio'];
         $chan->free_time = $data['tiempo_libre'];
         $chan->save();
     } else {
         Challenge::create(['name' => $data['Nombre'], 'duration' => $data['Duración_reto'], 'schedumal' => $data['Hora_inicio'], 'free_time' => $data['tiempo_libre']]);
     }
     $pag = $this->pagination();
     return view('challenge.index', compact('pag'));
 }
Ejemplo n.º 4
0
 public function newChallenge(Request $request, $challengeType)
 {
     $newChallenge = $request->all();
     $newChallenge['isWeekly'] = $challengeType === 'weekly' ? true : false;
     return Challenge::create($newChallenge);
 }