Skip to content

Commit b3a61e7

Browse files
committed
fix: consultations
1 parent 3955939 commit b3a61e7

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

app/Http/Controllers/Backend/UserAppointmentController.php

+16-3
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,17 @@ public function index() {
4545
->paginate(paginateCount());
4646
} else {
4747
$appointments = UserAppointment::unapproved()
48-
->whereNull('expert_profile_id')
4948
->with('map', 'user')
5049
->where(function(Builder $builder){
5150
if (request('map_id')) {
5251
$builder->where('map_id', request('map_id'));
5352
}
53+
54+
if (request('consultation')) {
55+
$builder->whereNotNull('expert_profile_id');
56+
} else{
57+
$builder->whereNull('expert_profile_id');
58+
}
5459
})
5560
->latest()
5661
->paginate(paginateCount());
@@ -115,12 +120,16 @@ public function approvedList() {
115120
->paginate(paginateCount());
116121
} else {
117122
$appointments = UserAppointment::approvedOnly()
118-
->whereNull('expert_profile_id')
119123
->with('map', 'user')
120124
->where(function(Builder $builder){
121125
if (request('map_id')) {
122126
$builder->where('map_id', request('map_id'));
123127
}
128+
if (request('consultation')) {
129+
$builder->whereNotNull('expert_profile_id');
130+
} else{
131+
$builder->whereNull('expert_profile_id');
132+
}
124133
})
125134
->latest()
126135
->paginate(paginateCount());
@@ -147,12 +156,16 @@ public function completedList() {
147156
->paginate(paginateCount());
148157
} else {
149158
$appointments = UserAppointment::completedOnly()
150-
->whereNull('expert_profile_id')
151159
->with('map', 'user')
152160
->where(function(Builder $builder){
153161
if (request('map_id')) {
154162
$builder->where('map_id', request('map_id'));
155163
}
164+
if (request('consultation')) {
165+
$builder->whereNotNull('expert_profile_id');
166+
} else{
167+
$builder->whereNull('expert_profile_id');
168+
}
156169
})
157170
->latest()
158171
->paginate(paginateCount());

0 commit comments

Comments
 (0)