Beispiel #1
0
 public function MemberQuery($id)
 {
     if ($id == 0) {
         $user_details = RegisterDetails::with(['users', 'reg1', 'reg2', 'reg1.sList', 'reg2.sList', 'habits'])->where('phone', '<>', '')->orderby('id')->paginate(75);
         return view('console.member-query', compact('user_details', 'id'));
     } else {
         $count = RegisterDetails::with(['users', 'reg1', 'reg2', 'reg1.sList', 'reg2.sList', 'habits'])->whereHas('reg1', function ($query) use($id) {
             $query->where('reg_subject_1', $id)->where('already_pick_1', 1)->orderBy('stu_id', 'ASC');
         })->orWhereHas('reg2', function ($query) use($id) {
             $query->where('reg_subject_2', $id)->where('already_pick_2', 1)->orderBy('stu_id', 'ASC');
         })->count();
         $user_details = RegisterDetails::with(['users', 'reg1', 'reg2', 'reg1.sList', 'reg2.sList', 'habits'])->whereHas('reg1', function ($query) use($id) {
             $query->where('reg_subject_1', $id)->where('already_pick_1', 1)->orderBy('stu_id', 'ASC');
         })->orWhereHas('reg2', function ($query) use($id) {
             $query->where('reg_subject_2', $id)->where('already_pick_2', 1)->orderBy('stu_id', 'ASC');
         })->paginate(300);
         $user_details_secondary = RegisterDetails::with(['users', 'reg1', 'reg2', 'reg1.sList', 'reg2.sList', 'habits'])->whereHas('reg1', function ($query) use($id) {
             $query->where('reg_subject_1', $id)->where('already_pick_1', 0);
         })->orWhereHas('reg2', function ($query) use($id) {
             $query->where('reg_subject_2', $id)->where('already_pick_2', 0);
         })->orderby('id')->paginate(300);
         return view('console.member-query', compact('user_details', 'user_details_secondary', 'id', 'count'));
     }
 }