public function add_retreat($event_id = 0) { $staff = \montserrat\Contact::with('groups')->whereHas('groups', function ($query) { $query->where('group_id', '=', GROUP_ID_STAFF); })->orderBy('sort_name')->pluck('sort_name', 'id'); $retreats = \montserrat\Retreat::select(\DB::raw('CONCAT(idnumber, "-", title, " (",DATE_FORMAT(start_date,"%m-%d-%Y"),")") as description'), 'id')->orderBy('start_date', 'desc')->pluck('description', 'id'); $retreats->prepend('Unassigned', 0); $retreat = \montserrat\Retreat::findOrFail($event_id); // TODO: replace this with an autocomplete text box for performance rather than a dropdown box $participants = \montserrat\Registration::whereEventId($event_id)->whereCanceledAt(NULL)->get(); $current_user = Auth::user(); $user_email = \montserrat\Email::whereEmail($current_user->email)->first(); $defaults['event_id'] = $event_id; $defaults['event_description'] = $retreat->idnumber . '-' . $retreat->title . ' (' . $retreat->start_date . ')'; if (empty($user_email->contact_id)) { $defaults['user_id'] = 0; } else { $defaults['user_id'] = $user_email->contact_id; } return view('touchpoints.add_retreat', compact('staff', 'retreat', 'retreats', 'participants', 'defaults')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // $registration = \montserrat\Registration::findOrFail($id); $retreat = \montserrat\Retreat::findOrFail($registration->event_id); \montserrat\Registration::destroy($id); $countregistrations = \montserrat\Registration::where('event_id', '=', $registration->event_id)->count(); //$retreat->attending = $countregistrations; $retreat->save(); return Redirect::action('RegistrationsController@index'); }
public function retreatrosterreport($id) { $retreat = \montserrat\Retreat::where('idnumber', '=', $id)->first(); // $registrations = \montserrat\Registration::where('event_id','=',$retreat->id)->with('retreat','retreatant.suffix','retreatant.address_primary','retreatant.prefix')->get(); //dd($registrations); $registrations = \montserrat\Registration::select(\DB::raw('participant.*', 'contact.*'))->join('contact', 'participant.contact_id', '=', 'contact.id')->where('participant.event_id', '=', $retreat->id)->whereCanceledAt(NULL)->with('retreat', 'retreatant.languages', 'retreatant.parish.contact_a.address_primary', 'retreatant.prefix', 'retreatant.suffix', 'retreatant.address_primary.state', 'retreatant.phones.location', 'retreatant.emails.location', 'retreatant.emergency_contact', 'retreatant.notes', 'retreatant.occupation')->orderBy('contact.sort_name', 'asc')->orderBy('participant.notes', 'asc')->get(); return view('reports.retreatroster', compact('registrations')); // }
public function checkout($id) { /* checkout all registrations for a retreat where the arrived_at is not NULL and the departed is NULL for a particular event */ $retreat = \montserrat\Retreat::findOrFail($id); //verifies that it is a valid retreat id $registrations = \montserrat\Registration::whereEventId($id)->whereDepartedAt(NULL)->whereNotNull('arrived_at')->get(); foreach ($registrations as $registration) { $registration->departed_at = $registration->retreat_end_date; $registration->save(); } return Redirect::back(); }