public function edit_group($id) { // $registration = \montserrat\Registration::with('retreatant', 'retreat', 'room')->findOrFail($id); // $retreat = \montserrat\Retreat::findOrFail($registration->event_id); $retreatant = \montserrat\Contact::findOrFail($registration->contact_id); $retreats = \montserrat\Retreat::select(\DB::raw('CONCAT(idnumber, "-", title, " (",DATE_FORMAT(start_date,"%m-%d-%Y"),")") as description'), 'id')->where("end_date", ">", \Carbon\Carbon::today())->orderBy('start_date')->pluck('description', 'id'); //dd($retreats); //TODO: we will want to be able to switch between types when going from a group registration to individual room assignment if ($retreatant->contact_type == CONTACT_TYPE_INDIVIDUAL) { $retreatants = \montserrat\Contact::whereContactType(CONTACT_TYPE_INDIVIDUAL)->orderBy('sort_name')->pluck('sort_name', 'id'); } if ($retreatant->contact_type == CONTACT_TYPE_ORGANIZATION) { $retreatants = \montserrat\Contact::whereContactType(CONTACT_TYPE_ORGANIZATION)->whereSubcontactType($retreatant->subcontact_type)->orderBy('sort_name')->pluck('sort_name', 'id'); } $rooms = \montserrat\Room::orderby('name')->pluck('name', 'id'); $rooms->prepend('Unassigned', 0); /* Check to see if the current registration is for a past retreat and if so, add it to the collection */ // $retreats[0] = 'Unassigned'; if ($registration->retreat->end < \Carbon\Carbon::now()) { $retreats[$registration->event_id] = $registration->retreat->idnumber . '-' . $registration->retreat->title . " (" . date('m-d-Y', strtotime($registration->retreat->start_date)) . ")"; } return view('registrations.edit_group', compact('registration', 'retreats', 'rooms', 'retreatants')); }
public function assign_rooms($id) { //get this retreat's information $retreat = \montserrat\Retreat::with('retreatmasters', 'assistant', 'innkeeper', 'captains')->findOrFail($id); $registrations = \montserrat\Registration::where('event_id', '=', $id)->with('retreatant.parish')->orderBy('register_date', 'DESC')->get(); $rooms = \montserrat\Room::orderby('name')->pluck('name', 'id'); $rooms->prepend('Unassigned', 0); return view('retreats.assign_rooms', compact('retreat', 'registrations', 'rooms')); }