本文整理汇总了PHP中Service::getFirstServiceOfBusiness方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::getFirstServiceOfBusiness方法的具体用法?PHP Service::getFirstServiceOfBusiness怎么用?PHP Service::getFirstServiceOfBusiness使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service::getFirstServiceOfBusiness方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postIssueOther
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']);
}
示例2: postPersonalizedBusinesses
public function postPersonalizedBusinesses()
{
$processing = array();
$not_processing = array();
$post = json_decode(file_get_contents("php://input"));
if ($post) {
$user_timezone = isset($post->user_timezone) ? $post->user_timezone : 'Asia/Manila';
//ARA set user timezone if any
if ($post->latitude && $post->longitude) {
$res = Business::getBusinessByLatitudeLongitude($post->latitude, $post->longitude, $user_timezone);
// get location first
if (!count($res)) {
$res = Business::all();
}
} else {
$res = Business::all();
}
foreach ($res as $count => $data) {
$first_service = Service::getFirstServiceOfBusiness($data->business_id);
$all_numbers = ProcessQueue::allNumbers($first_service->service_id);
$time_open = $data->open_hour . ':' . Helper::doubleZero($data->open_minute) . ' ' . strtoupper($data->open_ampm);
$time_close = $data->close_hour . ':' . Helper::doubleZero($data->close_minute) . ' ' . strtoupper($data->close_ampm);
// check if business is currently processing numbers
if (Business::processingBusinessBool($data->business_id)) {
if (Auth::check()) {
$processing[] = array('business_id' => $data->business_id, 'business_name' => $data->name, 'local_address' => $data->local_address, 'time_open' => Helper::changeBusinessTimeTimezone($time_open, $data->timezone, $user_timezone), 'time_close' => Helper::changeBusinessTimeTimezone($time_close, $data->timezone, $user_timezone), 'waiting_time' => Analytics::getWaitingTimeString($data->business_id), 'last_number_called' => count($all_numbers->called_numbers) > 0 ? $all_numbers->called_numbers[0]['priority_number'] : 'none', 'next_available_number' => $all_numbers->next_number, 'last_active' => Analytics::getLastActive($data->business_id), 'card_bool' => true);
} else {
$processing[] = array('business_id' => $data->business_id, 'business_name' => $data->name, 'local_address' => $data->local_address);
}
} else {
if (Auth::check()) {
$not_processing[] = array('business_id' => $data->business_id, 'business_name' => $data->name, 'local_address' => $data->local_address, 'time_open' => Helper::changeBusinessTimeTimezone($time_open, $data->timezone, $user_timezone), 'time_close' => Helper::changeBusinessTimeTimezone($time_close, $data->timezone, $user_timezone), 'waiting_time' => Analytics::getWaitingTimeString($data->business_id), 'last_number_called' => count($all_numbers->called_numbers) > 0 ? $all_numbers->called_numbers[0]['priority_number'] : 'none', 'next_available_number' => $all_numbers->next_number, 'last_active' => Analytics::getLastActive($data->business_id), 'card_bool' => false);
} else {
$not_processing[] = array('business_id' => $data->business_id, 'business_name' => $data->name, 'local_address' => $data->local_address);
}
}
}
$merged_businesses = array_merge($processing, $not_processing);
if (Auth::check()) {
// dashboard business boxes should be 8; known users will be redirected to dashboard
$merged_businesses = array_slice($merged_businesses, 0, 8);
} else {
// homepage business boxes should be only 7 to give space for (more business) box; anon users will be redirected to homepage
$merged_businesses = array_slice($merged_businesses, 0, 7);
}
return json_encode($merged_businesses);
}
}
示例3: getBusinessServiceDetails
/**
* @param $facebook_id
* @return JSON-formatted response of the business name, estimated time, people-in-queue and next number available .
*/
public function getBusinessServiceDetails($facebook_id)
{
try {
$user_id = User::getUserIdByFbId($facebook_id);
} catch (Exception $e) {
$user_id = null;
}
if ($user_id) {
$business_id = UserBusiness::getBusinessIdByOwner($user_id);
$business_name = Business::name($business_id);
$estimated_time = Analytics::getWaitingTime($business_id);
$service = Service::getFirstServiceOfBusiness($business_id);
$remaining_queue_count = Analytics::getServiceRemainingCount($service->service_id);
$next_available_number = ProcessQueue::nextNumber(ProcessQueue::lastNumberGiven($service->service_id), QueueSettings::numberStart($service->service_id), QueueSettings::numberLimit($service->service_id));
$details = ['business_name' => $business_name, 'estimated_time' => $estimated_time, 'people_in_queue' => $remaining_queue_count, 'next_available_number' => $next_available_number];
return Response::json($details, 200, array(), JSON_PRETTY_PRINT);
} else {
return json_encode(['error' => 'Something went wrong!']);
}
}
示例4: getBusiness
/**
* @author Ruffy
* @param int $business_id
* @return mixed
* @description Adds an option to display the broadcast page by Business
*/
public function getBusiness($business_id = 0)
{
$data = json_decode(file_get_contents(public_path() . '/json/' . $business_id . '.json'));
$arr = explode("-", $data->display);
if ($arr[0]) {
$template_type = 'ads-' . $arr[1];
} else {
$template_type = 'noads-' . $arr[1];
}
if ($data->ad_type == 'image') {
$ad_src = array();
$res = AdImages::getAllImagesByBusinessId($business_id);
foreach ($res as $count => $img) {
$ad_src[] = $img->path;
}
/*
$ad_directory = public_path() . '/ads/' . $business_id;
if (file_exists($ad_directory)) {
foreach(glob($ad_directory . '/*.*') as $filename){
$ad_src[] = 'ads/' . $business_id . '/' . basename($filename);
}
}
*/
} else {
$ad_src = $data->ad_video;
}
$business_name = Business::name($business_id);
$open_time = str_pad(Business::openHour($business_id), 2, 0, STR_PAD_LEFT) . ':' . str_pad(Business::openMinute($business_id), 2, 0, STR_PAD_LEFT) . ' ' . Business::openAMPM($business_id);
$close_time = str_pad(Business::closeHour($business_id), 2, 0, STR_PAD_LEFT) . ':' . str_pad(Business::closeMinute($business_id), 2, 0, STR_PAD_LEFT) . ' ' . Business::closeAMPM($business_id);
$first_service = Service::getFirstServiceOfBusiness($business_id);
$allow_remote = QueueSettings::allowRemote($first_service->service_id);
// Update Contact Form with Custom Fields if applicable
$custom_fields = '';
$forms = new FormsController();
$fields = $forms->getFields($business_id);
foreach ($fields as $form_id => $field_data) {
if ($field_data['field_type'] == 'Text Field') {
$custom_fields .= '<div class="col-md-3"><label>' . $field_data['label'] . '</label></div>
<div class="col-md-9"><input type="text" class="form-control custom-field" id="forms_' . $form_id . '" /></div>';
} elseif ($field_data['field_type'] == 'Radio') {
$custom_fields .= '<div class="col-md-3"><label>' . $field_data['label'] . '</label></div>
<div class="col-md-9"><label class="radio-inline"><input type="radio" name="forms_' . $form_id . '" value="' . $field_data['value_a'] . '" >' . $field_data['value_a'] . '</label><label class="radio-inline"><input type="radio" name="forms_' . $form_id . '" value="' . $field_data['value_b'] . '">' . $field_data['value_b'] . '</label></div>';
} elseif ($field_data['field_type'] == 'Checkbox') {
$custom_fields .= '<div class="col-md-offset-3 col-md-9 mb10 mt10"><label class="checkbox-inline"><input type="checkbox" id="forms_' . $form_id . '" value="1"/>' . $field_data['label'] . '</label></div>';
} elseif ($field_data['field_type'] == 'Dropdown') {
$select_options = '';
$select_options .= '<option value="0">- Select -</option>';
foreach ($field_data['options'] as $count => $val) {
$select_options .= '<option value="' . $val . '">' . $val . '</option>';
}
$custom_fields .= '<div class="col-md-3"><label>' . $field_data['label'] . '</label></div>
<div class="col-md-9"><select class="form-control custom-dropdown" id="forms_' . $form_id . '"/>' . $select_options . '</select></div>';
}
}
$ticker_message = array();
if (isset($data->ticker_message)) {
if ($data->ticker_message != '') {
array_push($ticker_message, $data->ticker_message);
}
}
if (isset($data->ticker_message2)) {
if ($data->ticker_message2 != '') {
array_push($ticker_message, $data->ticker_message2);
}
}
if (isset($data->ticker_message3)) {
if ($data->ticker_message3 != '') {
array_push($ticker_message, $data->ticker_message3);
}
}
if (isset($data->ticker_message4)) {
if ($data->ticker_message4 != '') {
array_push($ticker_message, $data->ticker_message4);
}
}
if (isset($data->ticker_message5)) {
if ($data->ticker_message5 != '') {
array_push($ticker_message, $data->ticker_message5);
}
}
if (Auth::check()) {
$user = User::getUserByUserId(Auth::user()->user_id);
// business owners have different broadcast screens for display
if (UserBusiness::getBusinessIdByOwner(Auth::user()->user_id) == $business_id) {
if ($arr[0] == 2 || $arr[0] == 3) {
$ad_src = $data->tv_channel;
// check if TV is on
if ($arr[0] == 3) {
$template_type = 'ads-' . $arr[1] . '-2';
}
$broadcast_template = 'broadcast.default.internet-tv-master';
} else {
$broadcast_template = 'broadcast.default.business-master';
}
//.........这里部分代码省略.........