/**
  * Insert new Tournament Participant
  *
  * @param  array  $data
  * @return Participant
  */
 public function create_participant(array $data)
 {
     $player = \DB::table('participants')->where('tournament_id', '=', $data['tournament_id'])->where('player_id', '=', $data['player_id'])->where('division_id', '=', $data['division_id'])->first();
     if (is_null($player)) {
         return Participant::create(['tournament_id' => $data['tournament_id'], 'player_id' => $data['player_id'], 'division_id' => $data['division_id']]);
     }
 }
 public function storeMessage($user, $input)
 {
     $thread = Thread::create(['subject' => $input['subject']]);
     Message::create(['thread_id' => $thread->id, 'user_id' => Auth::user()->id, 'body' => $input['message']]);
     Participant::create(['thread_id' => $thread->id, 'user_id' => Auth::user()->id, 'last_read' => new Carbon()]);
     Participant::create(['thread_id' => $thread->id, 'user_id' => $user->id, 'last_read' => new Carbon()]);
     $this->sentMessageNotification($user);
 }
Example #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $meetupgroup = ['pcf', 'biker', 'afterdark', 'lover', ''];
     foreach (range(1, 30) as $index) {
         Participant::create(['fullname' => $faker->name(), 'contactno' => $faker->phoneNumber(), 'email' => $faker->email(), 'meetupgroup' => $meetupgroup[rand(0, 4)], 'comment' => $faker->sentence(3)]);
     }
 }
 public function store(storePlaythroughRequest $request)
 {
     print_r($request->all());
     $game = $request->get('game');
     $users = $request->get('players');
     $winners = $request->get('winners');
     $userArr = explode(',', $users);
     $winnerArr = explode(',', $winners);
     $date = Carbon::createFromFormat('m/d/Y', $request->get('daterange'));
     $time = Carbon::createFromFormat('g:i', $request->get('timerange'));
     $playthrough = Playthrough::create(['game_id' => $game, 'played' => $date, 'duration' => $time, 'notes' => $request->get('notes')]);
     foreach ($userArr as $user) {
         if (in_array($user, $winnerArr)) {
             $w = 1;
         } else {
             $w = 0;
         }
         Participant::create(['playthrough_id' => $playthrough->id, 'game_id' => $game, 'user_id' => $user, 'score' => $request->input('person-' . $user), 'winner' => $w]);
     }
     return redirect()->route('playthrough');
 }
 private function makeNestedSetArray($row, $org, $role)
 {
     foreach ($row as $p) {
         $supervisorId = (string) $p->supervisor_id;
         $nested[$supervisorId]['root']['participant_id'] = $supervisorId;
         $nested[$supervisorId]['root']['name'] = (string) $p->supervisor_name;
         $nested[$supervisorId]['root']['type'] = 'Supervisor';
         $nested[$supervisorId]['root']['org_id'] = $org;
         $nested[$supervisorId]['root']['base'] = (string) $p->supervisor_location;
         $nested[$supervisorId]['root']['pcode'] = (string) $p->custom_location_code;
         $nested[$supervisorId]['root']['phones']['mobile'] = $p->spot_checker_mobile;
         $nested[$supervisorId]['root']['phones']['emergency'] = $p->spot_checker_emergency;
         $nested[$supervisorId]['root']['locations']['state'] = $p->stateregion_english;
         $nested[$supervisorId]['root']['locations']['district'] = $p->district_english;
         $nested[$supervisorId]['root']['locations']['township'] = $p->township_english;
         $nested[$supervisorId]['root']['locations']['village_tract'] = $p->village_tractward_burmese;
         $nested[$supervisorId]['root']['locations']['village'] = $p->polling_station_location_burmese;
         $nested[$supervisorId]['children'][0]['participant_id'] = $p->observer_a_id;
         $nested[$supervisorId]['children'][0]['name'] = $p->observer_a_name_burmese;
         $nested[$supervisorId]['children'][0]['type'] = 'Observer';
         $nested[$supervisorId]['children'][0]['base'] = $p->polling_station_location_burmese;
         $nested[$supervisorId]['children'][0]['dob'] = $p->observer_a_birthdate;
         $nested[$supervisorId]['children'][0]['nrc_id'] = $p->observer_a_nrc_card;
         $nested[$supervisorId]['children'][0]['gender'] = $p->observer_a_gender;
         $nested[$supervisorId]['children'][0]['pcode'] = (string) $p->custom_location_code;
         $nested[$supervisorId]['children'][0]['report_plan_a'] = $p->report_plan_a;
         $nested[$supervisorId]['children'][0]['report_plan_b'] = $p->report_plan_b;
         $nested[$supervisorId]['children'][0]['phones']['mobile'] = $p->observer_a_mobile;
         $nested[$supervisorId]['children'][0]['phones']['emergency'] = $p->emergency_contact_phone_observer_a;
         $nested[$supervisorId]['children'][0]['locations']['state'] = $p->stateregion_english;
         $nested[$supervisorId]['children'][0]['locations']['district'] = $p->district_english;
         $nested[$supervisorId]['children'][0]['locations']['township'] = $p->township_english;
         $nested[$supervisorId]['children'][0]['locations']['village_tract'] = $p->village_tractward_burmese;
         $nested[$supervisorId]['children'][0]['locations']['village'] = $p->polling_station_location_burmese;
         $nested[$supervisorId]['children'][1]['participant_id'] = $p->observer_b_id;
         $nested[$supervisorId]['children'][1]['name'] = $p->observer_b_name_burmese;
         $nested[$supervisorId]['children'][1]['type'] = 'Observer';
         $nested[$supervisorId]['children'][1]['base'] = $p->polling_station_location_burmese;
         $nested[$supervisorId]['children'][1]['dob'] = $p->observer_b_birthdate;
         $nested[$supervisorId]['children'][1]['nrc_id'] = $p->observer_b_nrc_card;
         $nested[$supervisorId]['children'][1]['gender'] = $p->observer_b_gender;
         $nested[$supervisorId]['children'][1]['pcode'] = (string) $p->custom_location_code;
         $nested[$supervisorId]['children'][1]['report_plan_a'] = $p->report_plan_a;
         $nested[$supervisorId]['children'][1]['report_plan_b'] = $p->report_plan_b;
         $nested[$supervisorId]['children'][1]['phone']['mobile'] = $p->observer_b_mobile;
         $nested[$supervisorId]['children'][1]['phone']['emergency'] = $p->emergency_contact_phone_observer_b;
         $nested[$supervisorId]['children'][1]['phones']['emergency'] = $p->emergency_contact_phone_observer_a;
         $nested[$supervisorId]['children'][1]['locations']['state'] = $p->stateregion_english;
         $nested[$supervisorId]['children'][1]['locations']['district'] = $p->district_english;
         $nested[$supervisorId]['children'][1]['locations']['township'] = $p->township_english;
         $nested[$supervisorId]['children'][1]['locations']['village_tract'] = $p->village_tractward_burmese;
         $nested[$supervisorId]['children'][1]['locations']['village'] = $p->polling_station_location_burmese;
         $nested[$supervisorId]['children'][2]['participant_id'] = (string) $p->spot_checker_id;
         $nested[$supervisorId]['children'][2]['name'] = isset($p->spot_checker_name) ? $p->spot_checker_name : null;
         $nested[$supervisorId]['children'][2]['type'] = 'Spot Checker';
         $nested[$supervisorId]['children'][2]['pcode'] = (string) $p->custom_location_code;
         $nested[$supervisorId]['children'][2]['phones']['mobile'] = $p->spot_checker_mobile;
         $nested[$supervisorId]['children'][2]['phones']['emergency'] = $p->spot_checker_emergency;
         $nested[$supervisorId]['children'][2]['phones']['emergency'] = $p->emergency_contact_phone_observer_a;
         $nested[$supervisorId]['children'][2]['locations']['state'] = $p->stateregion_english;
         $nested[$supervisorId]['children'][2]['locations']['district'] = $p->district_english;
         $nested[$supervisorId]['children'][2]['locations']['township'] = $p->township_english;
         $nested[$supervisorId]['children'][2]['locations']['village_tract'] = $p->village_tractward_burmese;
         $nested[$supervisorId]['children'][2]['locations']['village'] = $p->polling_station_location_burmese;
         //dd($nested);
         $root = Participant::create($nested[$supervisorId]['root']);
         $root->makeTree($nested[$supervisorId]['children']);
     }
     return $nested;
 }
Example #6
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request $request
  * @return Response
  */
 public function store(ParticipantRequest $request, Participant $participant)
 {
     $participant->create($request->all());
     flash('Participant has been added');
     return Redirect::back();
 }
 public function saveParticipants()
 {
     $attributes = Input::all();
     $validator = Validator::make(Input::all(), $this->rules);
     $participant['name'] = $attributes['name'];
     $participant['cost_amt'] = $attributes['cost_amt'];
     $participant['received_amt'] = $attributes['received_amt'];
     $participant['return_amt'] = $attributes['return_amt'];
     $participant['is_member'] = $attributes['is_member'];
     $result = Participant::create($participant);
     $participant_type['participant_id'] = $result['id'];
     $participant_type['adult'] = $attributes['adult'];
     $participant_type['children'] = $attributes['children'];
     $participant_type['senior'] = $attributes['senior'];
     $result_participant = Participators_type::create($participant_type);
     if ($result_participant) {
         return redirect()->action('HomeController@addParticipants')->with('success', 'Participant Created Successfully.');
     }
 }