コード例 #1
0
 public function run()
 {
     $volunteers = \teambernieny\VDBVolunteer::all();
     //Top ten data conversion for now
     for ($x = 0; $x < sizeof($volunteers); $x++) {
         $volunteer = $volunteers[$x];
         //clean out the 999s
         $volunteer = $this->validate($volunteer);
         //add neighborhood if doesn't exist
         $neighborhoods = \teambernieny\Neighborhood::where('Name', '=', $volunteer->Neighborhood)->get();
         if (sizeof($neighborhoods) == 0 && $volunteer->Neighborhood != "") {
             DB::table('neighborhoods')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'Name' => $volunteer->Neighborhood, 'Borough' => $volunteer->City]);
             $neighborhood_id = \teambernieny\Neighborhood::max('id');
         } else {
             if ($volunteer->Neighborhood == "") {
                 $neighborhood_id = "1";
             } else {
                 $neighborhood_id = $neighborhoods[0]->id;
             }
         }
         // add volunteer
         DB::table('volunteers')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'FirstName' => $volunteer->FirstName, 'LastName' => $volunteer->LastName, 'Email' => $volunteer->EMail1, 'Phone' => $volunteer->Phone1, 'neighborhood_id' => $neighborhood_id, 'Zip' => $volunteer->Zip, 'Street' => $volunteer->Street, 'City' => $volunteer->City, 'State' => $volunteer->State, 'user_id' => "1", 'BadPhone' => $volunteer->Phone1Broken, 'BadEmail' => $volunteer->Email1Broken, 'DoNotContact' => $volunteer->DoNotContact]);
         $volunteerid = \teambernieny\Volunteer::max('id');
         DB::table('event_volunteers')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'event_id' => '1', 'volunteer_id' => $volunteerid, 'Relationship' => 'Attendee']);
         $eventvolunteers_id = \teambernieny\EventVolunteers::max('id');
         if ($volunteer->AttendEvent == "1") {
             DB::table('commitments')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'event_volunteers_id' => $eventvolunteers_id, 'Type' => "Attend"]);
         }
         if ($volunteer->HostEvent == "1") {
             DB::table('commitments')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'event_volunteers_id' => $eventvolunteers_id, 'Type' => "Host"]);
         }
     }
 }
コード例 #2
0
 private function returnCheck(Request $request, $message)
 {
     $eventvolunteers = "";
     $eventvolunteers = \teambernieny\EventVolunteers::with('commitments', 'volunteer', 'event')->where('event_id', '=', $request->event_id)->get();
     $event = \teambernieny\Event::find($request->event_id);
     return view('volunteer.attendee.check')->with(['message' => $message, 'event' => $event, 'eventvolunteers' => $eventvolunteers]);
 }