public function getEdit()
 {
     $id = Input::get('id');
     if (empty($id)) {
         return Redirect::back()->with('status', 'Invalid member.');
     }
     $data['Member'] = Member::find($id);
     if (empty($data['WardMember']) || empty($data['WardMember']->id)) {
         return Redirect::to('/members');
     }
     $authUser = Auth::user();
     $data['quorumId'] = $authUser->quorum_id;
     $data['wardId'] = $authUser->ward_id;
     $data['searchResult'] = Input::get('name');
     $data['existingHomeTeachers'] = Companionship::where('ward_id', '=', $authUser->ward_id)->where('quorum_id', '=', $authUser->quorum_id)->where(function ($query) use($id) {
         $query->where('ht_one_id', '=', $id)->orWhere('ht_two_id', '=', $id);
     })->get();
     $data['existingHomeTeacherCompanion'] = $this->getExistingHomeTeacherCompanionData($data['existingHomeTeachers']);
     $data['families'] = Member::where('ward_id', '=', $authUser->ward_id)->where('quorum_id', '=', $authUser->quorum_id)->orderBy('last_name', 'asc')->get();
     $data['districtList'] = District::where('ward_id', '=', $authUser->ward_id)->where('quorum_id', '=', $authUser->quorum_id)->get();
     $data['districtMembers'] = [];
     foreach ($data['districtList'] as $key => $district) {
         $data['districtMembers'][$key] = Member::find($district->member_id);
     }
     return view('companionships.edit', $data);
 }
Пример #2
0
 public function getIndex()
 {
     $authUser = Auth::user();
     $data['quorumId'] = $authUser->quorum_id;
     $data['wardId'] = $authUser->ward_id;
     $data['families'] = Member::where('ward_id', '=', $authUser->ward_id)->where('quorum_id', '=', $authUser->quorum_id)->orderBy('last_name', 'asc')->get();
     return view('members', $data);
 }
 public function getIndex()
 {
     $authUser = Auth::user();
     $data['quorumId'] = $authUser->quorum_id;
     $data['wardId'] = $authUser->ward_id;
     $data['families'] = Member::where('ward_id', '=', $authUser->ward_id)->where('quorum_id', '=', $authUser->quorum_id)->orderBy('last_name', 'asc')->get();
     $districts = District::where('ward_id', '=', $authUser->ward_id)->where('quorum_id', '=', $authUser->quorum_id)->get();
     $data['districts'] = [];
     foreach ($districts as $district) {
         $data['districts'][] = Member::find($district->member_id);
     }
     return view('districts', $data);
 }