PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / trunk
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution vtrunk
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
← All changes | app/Http/Controllers/AdminController.php +3 -20 1.5.01trunk View file →
@@ -2,10 +2,8 @@
2 2
3 3 namespace FluentBooking\App\Http\Controllers;
4 4
5 5 use FluentBooking\App\Models\Calendar;
6 -use FluentBooking\App\Models\Meta;
7 -use FluentBooking\App\Services\PermissionManager;
8 6 use FluentBooking\Framework\Http\Request\Request;
9 7 use FluentBooking\App\Services\Helper;
10 8
11 9 class AdminController extends Controller
@@ -37,8 +35,9 @@
37 35 $metaQueryArgs = [
38 36 'role__not_in' => ['subscriber'],
39 37 'number' => 50,
40 38 'fields' => ['ID', 'user_email', 'display_name'],
39 + /* phpcs:disable WordPress.DB.SlowDBQuery.slow_db_query_meta_query */
41 40 'meta_query' => [
42 41 'relation' => 'OR',
43 42 [
44 43 'key' => 'first_name',
@@ -131,27 +130,11 @@
131 130 }
132 131
133 132 public function getAllHosts(Request $request)
134 133 {
135 - $calendars = Calendar::with(['user'])
136 - ->where('type', 'simple')
137 - ->get();
134 + $allHosts = Calendar::getAllHosts();
138 135
139 - $deletedUser = __('Deleted User', 'fluent-booking');
140 -
141 - $hosts = $calendars->map(function ($calendar) use ($deletedUser) {
142 - $user = $calendar->user;
143 - return [
144 - 'id' => $user ? $user->ID : (int)$calendar->user_id,
145 - 'name' => $user ? $user->full_name : $deletedUser,
146 - 'label' => $user ? $user->display_name . ' (' . $user->user_email . ')' : $deletedUser,
147 - 'avatar' => $calendar->getAuthorPhoto(),
148 - 'calendar_id' => $calendar->id,
149 - 'deleted_user' => $user ? false : true
150 - ];
151 - });
152 -
153 136 return [
154 - 'hosts' => $hosts
137 + 'hosts' => $allHosts
155 138 ];
156 139 }
157 140 }