Skip to content

Commit 347c20a

Browse files
committed
fix: appointment page
1 parent e5f007c commit 347c20a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

app/Http/Controllers/Backend/UserAppointmentController.php

+13
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414

1515
class UserAppointmentController extends Controller
1616
{
17+
public function __construct() {
18+
if (request('type') != 'consultation'){
19+
if(!auth()->user()->hasRole('super admin')){
20+
abort(403, 'You don\'t have access to this page');
21+
}
22+
}
23+
}
1724
public function index()
1825
{
1926
$expert = auth()->user()->expertProfile;
@@ -24,6 +31,8 @@ public function index()
2431
if ($expert != null) {
2532
$q->where('expert_profile_id', $expert->id);
2633
}
34+
}{
35+
$q->whereNull('expert_profile_id');
2736
}
2837
})
2938
->with('map', 'user')->latest()->paginate(paginateCount());
@@ -78,6 +87,8 @@ public function approvedList()
7887
if ($expert != null) {
7988
$q->where('expert_profile_id', $expert->id);
8089
}
90+
}{
91+
$q->whereNull('expert_profile_id');
8192
}
8293
})
8394
->with('map', 'user')->latest('approved_at')->get();
@@ -95,6 +106,8 @@ public function completedList()
95106
if ($expert != null) {
96107
$q->where('expert_profile_id', $expert->id);
97108
}
109+
}{
110+
$q->whereNull('expert_profile_id');
98111
}
99112
})
100113
->with('map', 'user')->latest('completed_at')->get();

0 commit comments

Comments
 (0)