function appointment_calendar_check_user in Appointment Calendar 8
Implements function to get slot.
1 call to appointment_calendar_check_user()
- appointment_calendar_validate in ./
appointment_calendar.module - Implements validate function for appointment calendar validate.
File
- ./
appointment_calendar.module, line 291
Code
function appointment_calendar_check_user($selected_date, $time_slot, $uid) {
$db_conn = \Drupal::database();
$slot_query = $db_conn
->select('appointment_slots', 'ap');
$slot_query
->fields('ap', [
'slot',
]);
$slot_query
->leftJoin('node_field_data', 'node_data', 'node_data.nid = ap.nid');
$slot_query
->condition('ap.slot', $time_slot, '=');
$slot_query
->condition('ap.date', $selected_date, '=');
$slot_query
->condition('ap.uid', $uid, '=');
$slot_query
->condition('node_data.status', 1);
$slot_result = $slot_query
->execute()
->fetchAll();
return count($slot_result);
}