Example #1
0
 /**
  * Temporary function to migrate old data
  * @param type $pid
  */
 public function migrate($pid, $pcode, $org)
 {
     //echo $org;
     $pcode = substr($pcode, 0, -1);
     // get participant
     $participant = \App\Participant::find($pid);
     // attach participant to pcode
     if (!empty($pcode)) {
         $location = \App\PLocation::where('org_id', $org)->where('pcode', $pcode)->first();
         if (!empty($location)) {
             $participant->pcode()->attach($location->primaryid);
             $participant->save();
         } else {
             return false;
         }
     }
     return;
 }
Example #2
0
 public function index($participant_id)
 {
     $participant = Participant::find($participant_id);
     $data['trials'] = $participant->trials()->get();
     return view('participant', $data);
 }
 public function deleteParticipants($id)
 {
     $participant = Participant::find($id);
     $participantTypeall = Participators_type::where('participant_id', '=', $participant->id)->first();
     $participantType = Participators_type::find($participantTypeall->id);
     $participant->delete();
     $participantType->delete();
     if ($participant && $participantType) {
         return redirect()->action('HomeController@index');
     }
 }