public function postIssueOther() { $queue_platform = 'web'; $terminal_id = 0; $business_id = Input::get('business_id'); $forwarder_id = Input::get('forwarder_id'); $transaction_number = Input::get('transaction_number'); if (Business::getForwarderAllowedInBusiness($business_id, $forwarder_id)) { $name = PriorityQueue::name($transaction_number); $phone = PriorityQueue::phone($transaction_number); $email = PriorityQueue::email($transaction_number); $service = Service::getFirstServiceOfBusiness($business_id); $service_id = $service->service_id; $next_number = ProcessQueue::nextNumber(ProcessQueue::lastNumberGiven($service_id), QueueSettings::numberStart($service_id), QueueSettings::numberLimit($service_id)); $priority_number = $next_number; $number = ProcessQueue::issueNumber($service_id, $priority_number, null, $queue_platform, $terminal_id); PriorityQueue::updatePriorityQueueUser($number['transaction_number'], $name, $phone, $email); return json_encode(['success' => 1, 'number' => $number]); } return json_encode(['error' => 'You are not allowed to issue a number to this business']); }
/** * @param $service_id * @param $name * @param $phone * @param $email * @return JSON-formatted queued number */ public function getQueueNumber($service_id, $name, $phone, $email) { try { $next_number = ProcessQueue::nextNumber(ProcessQueue::lastNumberGiven($service_id), QueueSettings::numberStart($service_id), QueueSettings::numberLimit($service_id)); $priority_number = $next_number; $queue_platform = 'kiosk'; $number = ProcessQueue::issueNumber($service_id, $priority_number, null, $queue_platform); PriorityQueue::updatePriorityQueueUser($number['transaction_number'], $name, $phone, $email); $details = ['number_assigned' => $priority_number]; return Response::json($details, 200, array(), JSON_PRETTY_PRINT); } catch (Exception $e) { return json_encode(['error' => 'Something went wrong!']); } }