public function add_group($id) { // //$retreats = \montserrat\Retreat::where('end','>',\Carbon\Carbon::today())->pluck('idnumber','title','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()->subWeek())->orderBy('start_date')->pluck('description', 'id'); $retreats->prepend('Unassigned', 0); $groups = \montserrat\Group::orderBy('title')->pluck('title', 'id'); $rooms = \montserrat\Room::orderby('name')->pluck('name', 'id'); $rooms->prepend('Unassigned', 0); $defaults['group_id'] = $id; $defaults['retreat_id'] = 0; $dt_today = \Carbon\Carbon::today(); $defaults['today'] = $dt_today->month . '/' . $dt_today->day . '/' . $dt_today->year; return view('registrations.add_group', compact('retreats', 'groups', 'rooms', 'defaults')); //dd($retreatants); }
public function add_group($group_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'); $groups = \montserrat\Group::orderBy('title')->pluck('title', 'id'); $current_user = Auth::user(); $user_email = \montserrat\Email::whereEmail($current_user->email)->first(); $defaults['group_id'] = $group_id; if (empty($user_email->contact_id)) { $defaults['user_id'] = 0; } else { $defaults['user_id'] = $user_email->contact_id; } return view('touchpoints.add_group', compact('staff', 'groups', 'defaults')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // \montserrat\Group::destroy($id); return Redirect::action('GroupsController@index'); }
public function role($group_id) { //dd($group_id); $persons = \montserrat\Contact::with('groups', 'address_primary')->whereHas('groups', function ($query) use($group_id) { $query->where('group_id', '=', $group_id)->whereStatus('Added'); })->orderBy('sort_name')->get(); $group = \montserrat\Group::findOrFail($group_id); $role['name'] = $group->name; $role['email_link'] = ""; $email_list = ""; foreach ($persons as $person) { if (!empty($person->email_primary_text)) { $email_list .= $person->email_primary_text . ','; } if (!empty($email_list)) { $role['email_link'] = "<a href='mailto:?bcc=" . $email_list . "'>E-mail " . $group->name . " Group</a>"; } else { $role['email_link'] = NULL; } } return view('persons.role', compact('persons', 'role')); // }